Javafx ListView Update

Is there a way to force the ListView to be updated in Javafx 2.1 without reloading the list and changing the selected value?

An observable list consists of strings, so changing their value is not possible.

+3
source share
3 answers

Try:

... ObservableList<String> olist = ... ListView<String> listv = ... ... listv.setItems(null); listv.setItems(olist); 
+3
source

Wrapping string values ​​with a property of type SimpleStringProperty and changing this property value must be feasible.

+2
source

I use:

 private static final ObservableList<String> lists = FXCollections.observableArrayList(); ... synchronized(lists) { List<String> lsts = new ArrayList<>(); lsts.addAll(lists); lists.clear(); lists.addAll(lsts); } 
0
source

Source: https://habr.com/ru/post/946343/


All Articles