r/JavaFX • • Aug 11 '25

Tutorial New Article: List Extractors

https://www.pragmaticcoding.ca/javafx/elements/extractors

I'm looking to wrap up all my articles on the JavaFX Observable classes, and most of the last subjects left involve ObservableLists.

If you don't know ObservableList Extractors allow you to trigger listeners on an ObservableList when the List items are composed of ObservableValues.

For instance, let's say that you have a CustomerModel as your List items, and the CustomerModel has a bunch of StringProperties as its fields. Things like firstName, lastName, city, address - and they are all StringProperty.

Using an Extractor, you can trigger a Listener on the ObservableList when one of those CustomerModel has the value in one of those Property fields change. So if you changed, say, the firstName Property of one of the items, then the ObservableList would trigger a Listener.

Some of the native JavaFX Nodes, like TableView will detect changes to those fields without an Extractor, but Extractors can be really useful to trigger updates in Bindings that look inside the composed items.

Take a look and tell me what you think.

11 Upvotes

13 comments sorted by

View all comments

Show parent comment

1

u/dazzlespace Aug 16 '25

It comes from my laziness 🤣
My coding experience started a long time ago with various programming languages before any technologies like javadoc never existed.

If you want to understand and use this library it is hopefully fairly intuitive, but would also recommend asking DeepWiki (https://deepwiki.com/dazzle50/JTableFX) which IMHO is surprising good at answering most questions!

Also feel free to message me.