Example usage for javafx.collections ObservableList addAll

List of usage examples for javafx.collections ObservableList addAll

Introduction

In this page you can find the example usage for javafx.collections ObservableList addAll.

Prototype

boolean addAll(int index, Collection<? extends E> c);

Source Link

Document

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).

Usage

From source file:Main.java

public static void main(String[] args) {
    ObservableList<String> list = FXCollections.observableArrayList("one", "two");
    System.out.println(list);//from  w ww.jav  a  2  s . c  o m

    list.addListener(Main::onChanged);

    list.addAll("A", "B");
    System.out.println("After addAll() - list: " + list);

    list.remove(1, 3);
    System.out.println("After remove() - list: " + list);

    list.retainAll("one");
    System.out.println("After retainAll() - list: " + list);

    list.set(0, "ONE");
    System.out.println("After set() - list: " + list);
}

From source file:Main.java

private ObservableList<Data> getChartData() {
    ObservableList<Data> answer = FXCollections.observableArrayList();
    answer.addAll(new PieChart.Data("java", 17.56), new PieChart.Data("JavaFx", 31.37));
    return answer;
}

From source file:Main.java

private ObservableList<String> getData() {
    ObservableList<String> answer = FXCollections.observableArrayList();
    answer.addAll("Sales", "Products");
    return answer;
}

From source file:com.eby.admin.edit.admin.EditAdminController.java

public void addcbLvl() {
    //mengisi item untuk cbLevel
    ObservableList list = FXCollections.observableArrayList();
    list.addAll("admin", "operator");
    cbLevel.setItems(list);//from  w ww . ja v  a2s .  c  o  m
}

From source file:com.eby.admin.register.RegisterForAdminController.java

public void addcbLvl() {
    //menambah item pada cbLevel
    ObservableList list = FXCollections.observableArrayList();
    list.addAll("admin", "operator");
    cbLvl.setItems(list);//from  www. ja  v  a 2 s.c o m
}

From source file:Main.java

private ObservableList<XYChart.Series<String, Double>> getChartData() {
    double aValue = 1.56;
    double bValue = 1.06;
    ObservableList<XYChart.Series<String, Double>> answer = FXCollections.observableArrayList();
    Series<String, Double> aSeries = new Series<String, Double>();
    Series<String, Double> bSeries = new Series<String, Double>();
    aSeries.setName("a");
    bSeries.setName("b");

    for (int i = 2011; i < 2021; i++) {
        aSeries.getData().add(new XYChart.Data(Integer.toString(i), aValue));
        aValue = aValue + Math.random() - .5;
        bSeries.getData().add(new XYChart.Data(Integer.toString(i), bValue));
        bValue = bValue + Math.random() - .5;
    }//from   ww  w  . ja va 2  s. com
    answer.addAll(aSeries, bSeries);
    return answer;
}

From source file:Main.java

private ObservableList<XYChart.Series<String, Double>> getChartData() {
    double aValue = 17.56;
    double cValue = 17.06;
    ObservableList<XYChart.Series<String, Double>> answer = FXCollections.observableArrayList();
    Series<String, Double> aSeries = new Series<String, Double>();
    Series<String, Double> cSeries = new Series<String, Double>();
    aSeries.setName("a");
    cSeries.setName("C");

    for (int i = 2011; i < 2021; i++) {
        aSeries.getData().add(new XYChart.Data(Integer.toString(i), aValue));
        aValue = aValue + Math.random() - .5;
        cSeries.getData().add(new XYChart.Data(Integer.toString(i), cValue));
        cValue = cValue + Math.random() - .5;
    }/*from www  .  java  2 s .co  m*/
    answer.addAll(aSeries, cSeries);
    return answer;
}

From source file:Main.java

private ObservableList<XYChart.Series<String, Double>> getChartData() {
    double aValue = 1.56;
    double cValue = 1.06;
    ObservableList<XYChart.Series<String, Double>> answer = FXCollections.observableArrayList();
    Series<String, Double> aSeries = new Series<String, Double>();
    Series<String, Double> cSeries = new Series<String, Double>();
    aSeries.setName("a");
    cSeries.setName("C");

    for (int i = 2011; i < 2021; i++) {
        aSeries.getData().add(new XYChart.Data(Integer.toString(i), aValue));
        aValue = aValue + Math.random() - .5;
        cSeries.getData().add(new XYChart.Data(Integer.toString(i), cValue));
        cValue = cValue + Math.random() - .5;
    }//  w w w . j a v a 2s  . c  o  m
    answer.addAll(aSeries, cSeries);
    return answer;
}

From source file:Main.java

private ObservableList<XYChart.Series<String, Double>> getChartData() {
    double aValue = 10;
    double cValue = 20;
    ObservableList<XYChart.Series<String, Double>> answer = FXCollections.observableArrayList();
    Series<String, Double> aSeries = new Series<String, Double>();
    Series<String, Double> cSeries = new Series<String, Double>();
    aSeries.setName("a");
    cSeries.setName("C");

    for (int i = 2001; i < 2021; i++) {
        aSeries.getData().add(new XYChart.Data(Integer.toString(i), aValue));
        aValue = aValue + Math.random() * 100 - 50;
        cSeries.getData().add(new XYChart.Data(Integer.toString(i), cValue));
        cValue = cValue + Math.random() * 100 - 50;
    }// w  w w  . j  ava2 s  .  c om
    answer.addAll(aSeries, cSeries);
    return answer;
}

From source file:Main.java

private ObservableList<XYChart.Series<Integer, Double>> getChartData() {
    double aValue = 1.56;
    double bValue = 1.06;
    ObservableList<XYChart.Series<Integer, Double>> answer = FXCollections.observableArrayList();
    Series<Integer, Double> aSeries = new Series<Integer, Double>();
    Series<Integer, Double> bSeries = new Series<Integer, Double>();
    aSeries.setName("A");
    bSeries.setName("B");
    for (int i = 2011; i < 2016; i++) {
        double diff = Math.random();
        aSeries.getData().add(new XYChart.Data(i, aValue, diff));
        aValue = aValue + 10 * diff - 5;
        diff = Math.random();//from w  ww .  j  a  v a 2 s . com
        bSeries.getData().add(new XYChart.Data(i, bValue, diff));
        bValue = bValue + 10 * diff - 5;
        diff = Math.random();
    }
    answer.addAll(aSeries, bSeries);
    return answer;
}