Note that there are some explanatory texts on larger screens.

plurals
  1. POCreate a JavaFX primary stage inside a normal Java application
    primarykey
    data
    text
    <p>I have a launcher and a JavaFX class. The launcher creates a class called JavaFXApplication1. The JavaFXApplication contains the whole JavaFX code (Just a little example in this case) and should setup a window with one primary stage.</p> <p>The launcher has the static main entry point - but I read that JavaFX doesn't really use this entry point. This explains my console output (See the end of the post)</p> <p>I don't know if this is possible (Launcher create a JavaFX window - the entry point is <strong>not</strong> in the presentation class itself) . I don't want to use a preloader (I think preloaders are just for heavy loads during startup), because the launcher represents the whole program as one object (Presentation, business and persistence - a 3 layer program). The entry point should be outside the presentation class (in this example in the launcher class)</p> <p>The following example does work. But for me it is like a piece of "black magic"</p> <p>Here is my code</p> <p>Launcher:</p> <pre><code>package javafxapplication1; public class Launcher { public static void main(String[] args) { System.out.println("main()"); // Do some stuff and then create the UI class JavaFXApplication1 client = new JavaFXApplication1(); client.caller(args); } } </code></pre> <p>JavaFXApplication1:</p> <pre><code>package javafxapplication1; import javafx.application.Application; import javafx.stage.Stage; public class JavaFXApplication1 extends Application { @Override public void start(Stage primaryStage) { System.out.println("start()"); primaryStage.setTitle("I am a JavaFX app"); primaryStage.show(); } public void caller(String[] args) { System.out.println("caller()"); launch(args); } /* We call the main function from the client public static void main(String[] args) { launch(args); }*/ } </code></pre> <p>And the output for the program is:</p> <pre><code>start() </code></pre> <p>Is there a way to create such an application ? Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload