I have multiple lists which I would like to loop through and return all their items in their respective tabs as buttons, each having an action.
I have tried the following:
@FXML
private Tab aTab;
And then on button press:
StackPane tab = new StackPane();
tab.setStyle("-fx-background-color: Green");
Label text = new Label("titleLabel");
text.setStyle("-fx-font-size: 25px;");
tab.getChildren().add(text);
aTab.setContent(tab);
The immediate problem is that I get the exception
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException...
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
... 52 more
Caused by: java.lang.NullPointerException
at (the method I'm calling aTab.setContent(tab) in
...
And the slightly more insidious problem is that, as the amount of tabs grow, my code is going to get increasingly bloated.
Ideally, there would be a way to display the content on each tab using a general tab xml file but I have been unable to put something like this together.
How can this be done? Can this be done?