Reputation: 371
What is the easyest way in JAVAFX to create a table like that:
I'm considering using TableView or doing it with HBox and every table cell is it's own rectangle. What would you guys suggest?
Upvotes: 0
Views: 92
Reputation: 17536
It looks like you just need a 1 row of with many columns (per image) so a table isn't what I would use. A ListView is basically a 1 dimensional table which is what you are looking for. Using an ObservableList
as your data model is an easy way to feed data. Modify the list and the ListView
updates automatically
ObservableList<String> model = FXCollections.observableArrayList(
" ", "X", " ", "X", "X", " ", " ", "X");
listView.setOrientation(Orientation.HORIZONTAL);
ListView<String> listView = new ListView<String>(model);
This is a working example on GitHub:
Upvotes: 1