I'm creating a LinkedList
which contains favorite movies of someone.
I want to display the whole list in FXML, but a Label
doesn't support multi-line output.
This is the code I tried (filmFavoriten
is the LinkedList
):
static LinkedList<Film> filmFavoriten = new LinkedList<>();
@FXML
private void displayList() throws IOException {
GridPane pane = FXMLLoader.load(getClass().getClassLoader().getResource("displayList.fxml"));
rootpane.getChildren().setAll(pane);
for (int r = 0; r < filmFavoriten.size(); r++) {
Label listTable = new Label();
listTable.setText((r + 1) + ". " + filmFavoriten.get(r).title);
}
}
Please suggest.