Let a label show a Controller method and follow other values in the View.

The method does not write the Model, and a change to the label itself does not run the method again.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-30 17:37:06 +01:00
co-authored by Cursor
parent 99886efa8b
commit 6e3036669a
8 changed files with 442 additions and 16 deletions
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.VBox?>
<?import de.neitzel.fx.view.BindingList?>
<?import de.neitzel.fx.view.ComputedBinding?>
<?import de.neitzel.fx.view.DirectBinding?>
<VBox xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="de.neitzel.fx.view.computed.WorkingAgeController">
<fx:define>
<BindingList>
<DirectBinding control="nameField" property="text" path="name" direction="both"/>
<ComputedBinding control="workingAgeLabel" property="text" method="#workingAge"/>
</BindingList>
</fx:define>
<TextField fx:id="nameField" id="nameField"/>
<Label fx:id="workingAgeLabel" id="workingAgeLabel"/>
</VBox>