package javaapplication4; import javafx.application.Application; import javafx.beans.binding.Bindings; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.ScrollPane; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; public class JavaApplication4 extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { int h = 300; int w = 300; ScrollPane scrollView1 = new ScrollPane(); scrollView1.setTranslateX(10); scrollView1.setTranslateY(20); scrollView1.setPrefWidth(80); scrollView1.setPrefHeight(80); scrollView1.setContent(new Rectangle(0, 0, 0, 0)); scrollView1.setHbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS); Label label1 = new Label("hBar Policy: " + scrollView1.getHbarPolicy() + " \nvBar Policy: " + scrollView1.getVbarPolicy()); label1.textProperty().bind(Bindings.concat("hBar Policy: ", scrollView1.hbarPolicyProperty(), " \nvBar Policy: ", scrollView1.vbarPolicyProperty())); label1.setTranslateX(95); label1.setTranslateY(40); ScrollPane scrollView2 = new ScrollPane(); scrollView2.setTranslateX(10); scrollView2.setTranslateY(110); scrollView2.setContent(new Rectangle(0, 0, 0, 0)); scrollView2.setPrefWidth(80); scrollView2.setPrefHeight(80); scrollView2.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS); Label label2 = new Label("hBar Policy: " + scrollView2.getHbarPolicy() + " \nvBar Policy: " + scrollView2.getVbarPolicy()); label2.textProperty().bind(Bindings.concat("hBar Policy: ", scrollView2.hbarPolicyProperty(), " \nvBar Policy: ", scrollView2.vbarPolicyProperty())); label2.setTranslateX(95); label2.setTranslateY(130); ScrollPane scrollView3 = new ScrollPane(); scrollView3.setTranslateX(10); scrollView3.setTranslateY(200); scrollView3.setContent(new Rectangle(0, 0, 0, 0)); scrollView3.setPrefWidth(80); scrollView3.setPrefHeight(80); scrollView3.setHbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS); scrollView3.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS); Label label3 = new Label("hBar Policy: " + scrollView3.getHbarPolicy() + " \nvBar Policy: " + scrollView3.getVbarPolicy()); label3.textProperty().bind(Bindings.concat("hBar Policy: ", scrollView3.hbarPolicyProperty(), " \nvBar Policy: ", scrollView3.vbarPolicyProperty())); label3.setTranslateX(95); label3.setTranslateY(220); Scene scene = new Scene(new Group(), w, h); ((Group) scene.getRoot()).getChildren().addAll(scrollView1, label1, scrollView2, label2, scrollView3, label3); stage.setScene(scene); stage.show(); } }