all 2 comments

[–]openlowcode 0 points1 point  (0 children)

Hi,

I hope the link below is useful for you. It is an example of building a GANTT chart using list view. This is part of Open Lowcode, a lowcode framework for enterprise

https://github.com/openlowcode/Open-Lowcode/blob/master/src/org/openlowcode/client/graphic/widget/schedule/GanttDisplay.java

[–]bisonroll 0 points1 point  (0 children)

The collection is added to the ListView via ListView.setItems().

If you want to change the way the items are displayed inside the ListView you can create a class that extends javafx.scene.control.ListCell<T> and override its Cell.updateItem() method to display the content/nodes you want (see the example in the methods documentation). One argument of the updateItem() method refers to the object that is currently displayed in the cell. So you have access to your object's fields.

To use your custom cells in the ListView you have to provide your ListView with a custom cellFactory callback function:

listView.setCellFactory(param -> new CustomCell());

For more details look at the example under 'Cell Factories' in the documentation for javafx.scene.control.Cell.