I am about getting the hang of JavaFx programming and came across a weird construction in a Javafx controller file. The typical fx file, when generated usually contains a class :
@Override
public void initialize(URL url, ResourceBundle rb)
Strangely, my last project, already a little advanced, has the following class instead:
@Override
public void start (Stage primaryStage) throws Exception {
I am using NetBeans on ubuntu and since I am still getting used to javafx and NetBeans (after a couple of years using python), I reckon I must have messed something up along the way without noticing.
My effort to simply replace the class "public void start" with "public void initialize" returns, without further explanations:
error: method does not override or implement a method from a supertype
In NetBeans, we can access a menu with the shortcut Alt+Ins, from where it is possible to adjust the Override settings, but I am afraid to use it without fully understanding the reasons of the mishap and the implications of messing with the settings. But I need the "initialize class" back, since I would like to execute some functions on program startup, what seems to be impossible from the "start" class.
What is the best way to restore the "initialize class" or it's properties?
Thanks in advance for any kind suggestion.
public class FXMLDocument_Controller extends Application {
@FXML
private Button dialog;
//other @FXMLs ..
/**
*
* @param actionEvent
* @throws Exception
*/
}
//this is the class in the controller
@Override
public void start (Stage primaryStage) throws Exception {
}
//this is the class I would like to have (back)
@Override
public void initialize(URL url, ResourceBundle rb) {
System.out.println("hello world");
// TODO
}
public void openMessageBox(ActionEvent actionEvent) {
funtion
}
public void contextMenu (ContextMenuEvent contextMenuEvent) {
function
}
public void openDialog(ActionEvent event) throws IOException{
}