Presumptuous Posted September 14, 2020 Share Posted September 14, 2020 I'm not quite sure on how to launch a GUI that is built using JavaFX through the script I'm creating. Right now it is an inner class to the main script and this is the code I wrote to attempt launching it in the onStart() method of the script. try { Class init = Class.forName("Initialization"); Initialization.launch(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } Quote Link to comment Share on other sites More sharing options...
Nbacon Posted September 14, 2020 Share Posted September 14, 2020 public class x extends Application implements Runnable{ @Override public void start(Stage stage){ ...... stage.show(); } @Override public void run(){ launch(); } } then lanuch it in onStart() with new Thread(new x()).start(); Quote Link to comment Share on other sites More sharing options...
Explv Posted September 14, 2020 Share Posted September 14, 2020 51 minutes ago, Presumptuous said: I'm not quite sure on how to launch a GUI that is built using JavaFX through the script I'm creating. Right now it is an inner class to the main script and this is the code I wrote to attempt launching it in the onStart() method of the script. try { Class init = Class.forName("Initialization"); Initialization.launch(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } The OSBot app is a swing app, so you have to embed your JavaFX content within swing. You can do so using a JFrame + JFXPanel. For example: https://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm Or: https://stackoverflow.com/questions/40110175/how-to-run-javafx-stage-scene-in-swing-application Quote Link to comment Share on other sites More sharing options...
Presumptuous Posted September 14, 2020 Author Share Posted September 14, 2020 58 minutes ago, Explv said: The OSBot app is a swing app, so you have to embed your JavaFX content within swing. You can do so using a JFrame + JFXPanel. For example: https://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm Or: https://stackoverflow.com/questions/40110175/how-to-run-javafx-stage-scene-in-swing-application Thank-you this worked perfectly with minor adjustments. @Nbaconthank-you for the suggestion, did not launch because of what @Explvstated before about it being a Swing application. Quote Link to comment Share on other sites More sharing options...