Jump to content

JavaFX GUI Launching


Presumptuous

Recommended Posts

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();
}
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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