Change new value for IntegerProperty with set method : IntegerProperty « JavaFX « Java






Change new value for IntegerProperty with set method

 
import javafx.beans.binding.Bindings;
import javafx.beans.binding.NumberBinding;
import javafx.beans.binding.StringExpression;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;

public class Main {
    public static void main(String[] args) {
        IntegerProperty x1 = new SimpleIntegerProperty(0);
        IntegerProperty y1 = new SimpleIntegerProperty(0);

        final NumberBinding area = x1.multiply(y1)
                .divide(2.0D);

        StringExpression output = Bindings.format(
                "For A(%d,%d), the area is %3.1f",
                x1, y1, area);

        x1.set(0); y1.set(0);

        System.out.println(output.get());

        x1.set(10); y1.set(110);

        System.out.println(output.get());
    }
}

   
  








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.Create JavaFX bean with IntegerProperty, StringProperty and ObjectProperty