I made a note card program that can help you study with JavaFX. It saves the class through XML and on boot up, it finds the XML files and adds them to an ArrayList called allProjects of type NoteCardSet, an ArrayList of NoteCards. With this, I made a dynamic amount of buttons that puts them 4 columns wide. Here is the code for that:
int amountPerRow = 4;
int current = 0;
int row = 0;
for (NoteCardSet noteCardSet : allProjects) {
Button b = new Button(noteCardSet.getName());
GridPane.setConstraints(b, current, row);
centerMenu.getChildren().add(b);
b.setOnAction(e -> {
border.setCenter(noteCardSetLayout(noteCardSet));
});
if (current < amountPerRow - 1)
{
current++;
}
else if (current >= amountPerRow - 1)
{
current = 0;
row++;
}
}
Obviously this is creatable in JavaFX but is it possible to created this in FXML?