JavaFX ReadOnlyIntegerProperty create

Description

JavaFX ReadOnlyIntegerProperty create


import javafx.beans.property.ReadOnlyIntegerProperty;
import javafx.beans.property.ReadOnlyIntegerWrapper;

public class Main {
  public static void main(String[] args) {
    // Create a read-only wrapper property
    ReadOnlyIntegerWrapper idWrapper = new ReadOnlyIntegerWrapper(100);

    // Get the read-only version of the read-only wrapper property object
    ReadOnlyIntegerProperty id = idWrapper.getReadOnlyProperty();

    System.out.println("idWrapper:" + idWrapper.get());
    System.out.println("id:" + id.get());

    // Change the value
    idWrapper.set(101);/*from w w  w.  j a  va  2 s.c o  m*/

    System.out.println("idWrapper:" + idWrapper.get());
    System.out.println("id:" + id.get());
  }
}



PreviousNext

Related