How can I populate a TableView in JavaFX by using Arraylist?


Question

I want to populate table view in javafx by using array list .I do not want to use any model .i want to make array list as my source of data for populating tableview .

Code:


List<Double> doubles = new ArrayList<Double>();
    doubles.add(12.12d);
    ObservableList<Double> names = FXCollections.observableArrayList(doubles);

    TableView table_view = new TableView<>(names);

    firstDataColumn.setCellFactory(?????);/// here the problem comes what is the cell factory in case of arraylist      
1
1
7/22/2017 8:03:35 PM

You must use a ObservableList as your datasource and to achieve this when you have a List you can use:

FXCollections.observableList(yourList);
2
8/23/2013 1:04:29 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon