Note: this is not how to make a GUI. This is how to implement one. The following is assumed: You have one file that contains your GUI code. You have one file that contains your script code. Your GUI code has a 'start' button which is public or has a getter function. Let's start with your script code: public class TestScript extends Script { @Override public void onStart() throws InterruptedException { } @Override public int onLoop() throws InterruptedExce