I've got Controller that handles actions from UI created by a Scene Builder. Now when i'm trying to bind a label from this UI to a SimpleTextProperty inside a Controllers constructor i'm getting nullpointer exception. Apparently productInfoLabel is not instantiated yet. Where should i bind these in instead a constructor? Here's my code
public class Controller {
@FXML
public TableView receiptTable;
@FXML
public TextField productCodeTextField;
@FXML
public Label productInfoLabel;
private StringProperty stringProperty = new SimpleStringProperty();
public Controller() {
productInfoLabel.textProperty().bind(stringProperty);
}
}
So my question is how to do it properly?