I created a JavaFX project. Here is what it looks like:
In SceneBuilder I created a
BorderPane
with one label with the id label
.
In my SampleController
I use this Label named label
:
Label label;
public SampleController() {
label.setText("hi");
}
If I remove label.setText("hi");
the code works fine but when the code is there I get the following error.
It is very long, here is a part of it.
javafx.fxml.LoadException:
I think that is the most important part. I can however add buttons and their actions and it still works fine. now i added.
@FXML
private Pane taskPane;
private void initialize() {
System.out.println(taskPane.getWidth());
}
i did the same thing as the label with a pane and i get a null pointer exception.