Seems like i never gets correct reference from FXML.
FXML file:
<MenuBar xmlns:fx="http://javafx.com/fxml/1" fx:id="rootMenu" xmlns="http://javafx.com/javafx/8"
fx:controller="my.MenuController">
<Menu mnemonicParsing="false" text="Analysis">
<MenuItem fx:id="test" mnemonicParsing="false" onAction="#startNewAnalyze" text="New analysis"/>
Then in Controller file:
@FXML
private static MenuItem test;
@FXML
private void initialize() {
Systen.out.println(test.getText());
}
public static void setDisable(boolean enable) {
test.setDisable(enable);
}
This will give Nullpointer when calling the MenuController.setDisable(false);
Any ideas?