Jump to content

JavaFX GUI Launching


Recommended Posts

Posted

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();
}
Posted
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

 

Posted
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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...