I\'d like to know if there\'s possible to add an Image Button after every ListView Item. For example:
The previous solution worked fine when my list was not big and I didn't add more Controls making the Node more complex. When I added more Controls I found a problem with concurrency, maybe it is also because I am drawing maps that have more than 12000 objects (lines and polygons). The problem (what I could see) was that some of the items in ListView will be repeated internally meaning that cellfactory will be created twice and/or not created. It seems "updateItem" is last in the queue of the thread. So to work around the problem I have to create the node before creating the ListView. Something like this:
ObservableList list = FXCollections.observableArrayList();
for (AisaLayer layer : listLayers) {
mapLayers.put(layer.getLayerName(), layer);
list.add(new AisaNode(layer));
System.out.println("Ordered:" + layer.getLayerName());
}
lv.setItems(list);
lv.setCellFactory(new Callback, ListCell>() {
@Override
public ListCell call(ListView param) {
return new DefaultListCell<>();
}
});
I used the simple DefaultListCell recommended in fxexperience.com