Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR ASSEMBLY

javafx observable collection

import java.util.ArrayList;
import java.util.List;
//from w ww .j a v a 2  s .  c o m
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;

public class Main {

  public static void main(String[] args) {
    List<String> list = new ArrayList<String>();

    ObservableList<String> observableList = FXCollections.observableList(list);
    observableList.addListener(new ListChangeListener() {
      @Override
      public void onChanged(ListChangeListener.Change change) {
        System.out.println("change!");
      }
    });
    observableList.add("item one");
    list.add("item two");
    System.out.println("Size: " + observableList.size());

  }
}
Source by www.java2s.com #
 
PREVIOUS NEXT
Tagged: #javafx #observable #collection
ADD COMMENT
Topic
Name
3+5 =