Hi,
when i was learning JavaFX, i always had everything in 1 class with the main method that called launch() method. However, now im trying to follow MVC pattern and my main method looks like this:
public static void main(String[] args){
System.out.println("Inside the launcher code");
Model model = new Model();
MainView view = new MainView();
Controller controller = new Controller(model, view);
controller.getView().launch();
System.out.println("End of launcher code");
}
Basically, MainView is a class that extends Application and has start() method. Inside Controller i have a getView() method that returns instance of the MainView. Now, when i run the above code i get the error:
Inside the launcher code
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.javafx.main.Main.launchApp(Main.java:658)
at com.javafx.main.Main.main(Main.java:805)
Caused by: java.lang.RuntimeException: Error: class com.beans.Launcher is not a subclass of javafx.application.Application
at javafx.application.Application.launch(Application.java:211)
at com.beans.Launcher.main(Launcher.java:16)
... 6 more
Java Result: 1
jfxsa-run:
BUILD SUCCESSFUL (total time: 9 seconds)
Can Anyone shed any light on it? I can provide more code if necessary. Thank you !!
Edited by: 960152 on 2012-09-19 11:35