Binding IntegerProperty with multiply : IntegerProperty « JavaFX « Java






Binding IntegerProperty with multiply

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

public class Main {
  public static void main(String[] args) {

    final IntegerProperty width = new SimpleIntegerProperty(10);
    final IntegerProperty height = new SimpleIntegerProperty(10);

    NumberBinding area = width.multiply(height);

    System.out.println(width.get() + " "+ height.get());
    System.out.println(area.getValue());

    width.set(100);
    height.set(200);

    System.out.println(width.get() + " "+ height.get());
    System.out.println(area.getValue());
  }
}

   
  








Related examples in the same category

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