Reputation: 1141
How can i use two dimensional ObservableList in JavaFX? Or maybe use ObservableList with array of something, like
ObservableList<MyObject[]>
Maybe you can help me here? Anything simpler, is it two dimensional ObservableList or ObservableList with arrat or even other solution if exist. i tried with FXCollections method but nothing fit with this case. Anybody can help me here?
Upvotes: 2
Views: 2587
Reputation: 3654
I don't clearly understand, what you want to reach, using 2 dimensional data structure :
if you want a matrix with observing of items modification create arrayList of ObservaleArrayLists,
if you want a comb data structure - use observable list of observable lists.
But JavaFX doesn't support any 2-dimensional data structures, and seems, will not support. JavaFX will provide basic data structures. And you can use them to build anything you want.
It looks like matrix 10x10:
ObservableList<ObservableList<Integer>> matrix = FXCollections.<ObservableList<Integer>>observableArrayList();
for (int i = 0; i < 10; i++) {
final ObservableList<Integer> row = FXCollections.<Integer>observableArrayList();
matrix.add(i, row);
for (int j = 0; j < 10; j++) {
row.add(0);
}
}
Upvotes: 1