JavaFX SimpleIntegerProperty create

Description

JavaFX SimpleIntegerProperty create

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("Current - Width and Height     : " + width.get() + " " + height.get());
      System.out.println("Current - Area of the Rectangle: " + area.getValue());
      System.out.println("Modifying width and height");

      width.set(100);/*from  ww  w .  j ava 2  s .  c  o  m*/
      height.set(700);

      System.out.println("After - Width and Height     : " + width.get() + " " + height.get());
      System.out.println("After - Area of the Rectangle: " + area.getValue());

   }
}



PreviousNext

Related