- store the inner state of a control and allow us to listen to the state change
- that means that we will be able to perform an action when the value changes
Types:
- Read / Write
- Read-Only
Usage
- import javafx.beans.property
- Read / Write
- javafx.beans.property.SimpleStringProperty
- javafx.beans.property.SimpleDoubleProperty
- javafx.beans.property.SimpleIntegerProperty
- javafx.beans.property.SimpleBooleanProperty
- Read-Only
- javafx.beans.property.ReadOnlyBooleanWrapper
- javafx.beans.property.ReadOnlyIntegerWrapper
- javafx.beans.property.ReadOnlyDoubleWrapper
- javafx.beans.property.ReadOnlyStringWrapper
Example:
Read / Write
StringProperty value = new SimpleStringProperty("JavaFX); value.set("JavaFX Tutorial"); System.out.println("Changed StringProperty" + value.get());
Ready Only
ReadOnlyStringWrapper value = new ReadOnlyStringWrapper("JavaFX); ReadOnlyStringProperty readyOnlyValue = value.getReadOnlyProperty();
No comments:
Post a Comment