Example usage for javafx.scene.control ScrollPane hvalueProperty

List of usage examples for javafx.scene.control ScrollPane hvalueProperty

Introduction

In this page you can find the example usage for javafx.scene.control ScrollPane hvalueProperty.

Prototype

public final DoubleProperty hvalueProperty() 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 500, 200);
    stage.setScene(scene);/*ww  w .j av a  2 s .  c om*/

    Rectangle rect = new Rectangle(200, 200, Color.RED);
    ScrollPane s1 = new ScrollPane();
    s1.setPrefSize(120, 120);
    s1.setContent(rect);

    s1.vvalueProperty().addListener(new ChangeListener<Number>() {
        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            System.out.println(new_val.intValue());
        }
    });
    s1.hvalueProperty().addListener(new ChangeListener<Number>() {
        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            System.out.println(new_val.intValue());
        }
    });
    root.getChildren().add(s1);
    stage.show();
}