JavaFX_IntegerProperty1
  • Property classes provide two pairs of getter and setter methods: get()/set() and getValue()/ setValue
JavaFX supports properties, events, and binding through properties and binding APIs, through JavaBeans properties.
Code:

package javafxtemplate1;

import javafx.application.Application;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.event.ActionEvent;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
/**
*
* @author Manas9
*/
public class JavaFXTemplate1 extends Application {
public String str1;

@Override
public void start(Stage primaryStage) {
Group groot = new Group();
Label label1 = new Label("Caption");
label1.setLayoutX(120);label1.setLayoutY(20);
Button btn1 = new Button("click Me");
btn1.setOnAction((ActionEvent event) -> {
IntegerProperty counter = new SimpleIntegerProperty(1);
int n1 = counter.get();
label1.setText("OOOOOOPS " + Integer.toString(n1));

});
groot.getChildren().addAll(label1, btn1);

Scene scene = new Scene(groot, 350, 150);
primaryStage.setScene(scene);
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
}
}
/*
class DemoEventHandler1 implements EventHandler<ActionEvent>{

@Override
public void handle(ActionEvent event) {
Platform.exit();

}
}
*/