I have an ArrayList which I add some Objects to it dynamically, and I have a JButton. The ArrayList is empty when running my program and the JButton is set to setEnabled(fal
Javafx (part of JRE 8) provides an observable list implementation. This code works for me:
ObservableList lstAnno1 = FXCollections.observableList(new ArrayList());
lstAnno1.addListener((ListChangeListener.Change extends MyAnno> c) -> {
c.next();
updateAnnotation((List) c.getAddedSubList(), xyPlot);
});
...
lstAnno1.add(new MyAnno(lTs, dValue, strType));
...
public void updateAnnotation(List lstMyAnno, XYPlot xyPlot) {
lstMyAnno.forEach(d -> {
...
});
}