---
name: johannesrabauer/javafx-reactive-binding-state
source: https://app.decimal.ai/s/johannesrabauer-javafx-reactive-binding-state@1/SKILL.md
source_sha256: e0f65b8f8bfe
---

# JavaFX Reactive Bindings and State

Use this skill when core JavaFX properties are not enough and the application needs derived
observable graphs, composed event streams, reducer-style state, or synchronized reactive pipelines.

## Example

```java
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.transformation.FilteredList;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;

public class ReactiveFilterView extends VBox {

    private final StringProperty filter = new SimpleStringProperty("");

    public ReactiveFilterView() {
        var input = new TextField();
        var items = FXCollections.observableArrayList("alpha", "beta", "gamma", "delta");
        var filtered = new FilteredList<>(items, item -> true);

        filter.bind(input.textProperty());
        filter.addListener((obs, oldValue, newValue) ->
                filtered.setPredicate(item -> item.contains(newValue))
        );

        var status = new TextField();
        status.textProperty().bind(Bindings.size(filtered).asString("Matches: %d"));
        status.setEditable(false);

        getChildren().addAll(input, status, new ListView<>(filtered));
    }
}
```

## Setup notes

- Keep this skill for advanced state composition: EasyBind-style computed values, ReactFX or Rx-style
  streams, reducer architectures, and synchronized state pipelines.
- Reserve `javafx-properties-bindings` for plain `Property`, `Binding`, and listener usage.
- Make thread handoff explicit whenever reactive streams feed the JavaFX scene graph.

## Gotchas

- Reactive abstractions do not remove the need for ownership boundaries around state updates.
- Reducer-style state is valuable only if traceability or complex coordination justifies it.
- Cross-window or cross-client synchronization needs conflict rules, not just more observables.