I have a toolbar with several buttons. I want several of this buttons to load different FXML-files. The way it is done now is by rwiting the fxml file in Java code and inserting it everytime it get's called. It would be a much better choice if I could just call the FXML-file and get the correct scene. This is an example where i load a settings view:
public void showModelSettings(){
clearPane();
GridPane gridPane = new GridPane();
ColumnConstraints cc1 = new ColumnConstraints();
cc1.setPercentWidth(50);
ColumnConstraints cc2 = new ColumnConstraints();
cc2.setPercentWidth(50);
gridPane.getColumnConstraints().addAll(cc1,cc2);
RowConstraints rc1 = new RowConstraints();
rc1.setPercentHeight(30);
RowConstraints rc2 = new RowConstraints();
rc2.setPercentHeight(70);
gridPane.getRowConstraints().addAll(rc1,rc2);
//iwModel.setImage(new Image("C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"));
gridPane.setConstraints(cbModel, 0, 0);
gridPane.setConstraints(btnImageChooser, 1, 0);
gridPane.setConstraints(iwModel, 0, 1, 2, 1);
gridPane.getChildren().addAll(cbModel, btnImageChooser,iwModel);
mainPanel.getChildren().add(gridPane);
}
I have used tabpane at an earlier date, the handy thing with this is that it can load "content" which in a way is a actionlistener that can load fxml-files. I want this functionality for my toolbar buttons.
all help will be appreciated greatly! Thanks :)