Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use setCellValueFactory and setCellFactory?

Tags:

javafx

  1. How do we use setCellValueFactory and setCellFactory?
  2. What's difference between them?
like image 473
Wing Kui Tsoi Avatar asked Aug 30 '17 19:08

Wing Kui Tsoi


1 Answers

According to the documentation :

setCellValueFactory

The cell value factory needs to be set to specify how to populate all cells within a single TableColumn. A cell value factory is a Callback that provides a TableColumn.CellDataFeatures instance, and expects an ObservableValue to be returned. The returned ObservableValue instance will be observed internally to allow for immediate updates to the value to be reflected on screen.

setCellFactory

The cell factory for all cells in this column. The cell factory is responsible for rendering the data contained within each TableCell for a single table column. By default TableColumn uses the default cell factory, but this can be replaced with a custom implementation, for example to show data in a different way or to support editing.

Resource :http://docs.oracle.com/javase/8/javafx/api/toc.htm and http://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TableColumn.html#setCellFactory-javafx.util.Callback-

like image 130
Menai Ala Eddine - Aladdin Avatar answered Oct 04 '22 19:10

Menai Ala Eddine - Aladdin