Create JavaFX bean with IntegerProperty, StringProperty and ObjectProperty : IntegerProperty « JavaFX « Java






Create JavaFX bean with IntegerProperty, StringProperty and ObjectProperty

 

import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.paint.Color;

public class Main {
    private IntegerProperty i = new SimpleIntegerProperty(this, "i", 0);
    private StringProperty str = new SimpleStringProperty(this, "str", "Hello");
    private ObjectProperty<Color> color = new SimpleObjectProperty<Color>(this, "color", Color.BLACK);

    public final int getI() {
        return i.get();
    }

    public final void setI(int i) {
        this.i.set(i);
    }

    public IntegerProperty iProperty() {
        return i;
    }

    public final String getStr() {
        return str.get();
    }

    public final void setStr(String str) {
        this.str.set(str);
    }

    public StringProperty strProperty() {
        return str;
    }

    public final Color getColor() {
        return color.get();
    }

    public final void setColor(Color color) {
        this.color.set(color);
    }

    public ObjectProperty<Color> colorProperty() {
        return color;
    }
}

   
  








Related examples in the same category

1.Binding IntegerProperty with multiply
2.Create IntegerProperty from SimpleIntegerProperty and set constant value
3.Get value from IntegerProperty with get method
4.Get int value from IntegerProperty
5.InvalidationListener for IntegerProperty
6.ChangeListener for IntegerProperty
7.Bind and unbind IntegerProperty
8.Change new value for IntegerProperty with set method