I have a problem regarding Java FX and the implementation of the very weird Application. Let me show it with code:
Imagine a basic Application:
public class JavaFXApp extends Application {
// constructor, ...
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
// important stuff
initialize();
// important stuff
stage.show();
}
public void initialize() {
System.out.println("default");
// basically abstract
}
// and other functions.
}
and it’s extension (as is intended):
public class JavaFXAppExtended extends JavaFXApp {
// constructor, ...
@Override
public void initialize() {
System.out.println("extended");
}
}
Now the calling of JavaFXApp
yields no problem to my eye. But when calling JavaFXAppExtended
, the @Overwrite
is basically ignored and the initialize
from the parent class is called. Thereby:
JavaFXApp.main(args);
-> default
JavaFXAppExtended.main(args);
-> default
whereby “extended” was expected.
So, did I miss something important? Is this illegal? Am I not experienced enough? Might this just be a bug? I don’t know. But I want to know.