I have a launcher and a JavaFX class. Launcher creates a class called JavaFXApplication1. JavaFXApplication contains all the JavaFX code (just an example in this case) and should set up a window with one main step.
The launcher has a static main entry point, but I read that JavaFX does not actually use this entry point. This explains my console output (see End of post).
I don't know if this is possible (Launcher creates a JavaFX window - the entry point is not in the presentation class itself). I do not want to use a preloader (I think that preloaders are just for heavy loads during startup) because the launcher is an entire program as a single object (Presentation, business and persistence - 3-layer program). The entry point must be outside the view class (in this example, in the launch class)
The following example works. But for me it looks like a piece of "black magic"
Here is my code
Launcher:
package javafxapplication1; public class Launcher { public static void main(String[] args) { System.out.println("main()");
JavaFXApplication1:
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); } }
And the output for the program:
start()
Is there any way to create such an application? thank you
source share