I upgraded from JavaFX 8 b109 to b116 and my FXML controller class has the injected variables as null when it initializes. I tried it with the sample NetBeans FXML app.
@FXML
private static Label label;
@Override
public void initialize(URL url, ResourceBundle rb) {
label.setText("static test");
}
The problem is with the static
keyword. I remove that and it works. It was working fine in b109 with static variables. When writing my app initially, I figured static made sense. They're created when the application loads and there's only ever one copy of the scene.
Is there a way around this without rewriting a thousand lines of code that use static access?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…