Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;

public class Main {
    public static void main(String[] args) {
        IntegerProperty intProperty = new SimpleIntegerProperty(1024);
        final ChangeListener changeListener = new ChangeListener() {
            @Override
            public void changed(ObservableValue observableValue, Object oldValue, Object newValue) {
                System.out.println("oldValue:" + oldValue + ", newValue = " + newValue);
            }
        };

        intProperty.addListener(changeListener);
        intProperty.set(5120);

        intProperty.removeListener(changeListener);

        intProperty.set(6144);
    }
}