import javafx.application.Application; import javafx.stage.*; import javafx.scene.*; import javafx.scene.control.*; import javafx.beans.binding.Bindings; import javafx.collections.FXCollections; public class ScrollPaneSample extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { double h = 320; double w = 250; ScrollPane scrollView1 = new ScrollPane(); Button button = new Button("Inside"); button.setPrefWidth(120.0); button.setPrefHeight(120.0); scrollView1.setContent(button); scrollView1.setTranslateX(10); scrollView1.setTranslateY(40); scrollView1.setPrefWidth(60); scrollView1.setPrefHeight(60); scrollView1.setPannable(true); scrollView1.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); 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(75); label1.setTranslateY(40); ScrollPane scrollView2 = new ScrollPane(); Button button2 = new Button("Inside"); button2.setPrefWidth(120.0); button2.setPrefHeight(120.0); scrollView2.setContent(button2); scrollView2.setTranslateX(10); scrollView2.setTranslateY(110); //scrollView2.setManaged(false); scrollView2.setPrefWidth(60); scrollView2.setPrefHeight(60); scrollView2.setPannable(true); scrollView2.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); 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(75); label2.setTranslateY(110); ScrollPane scrollView3 = new ScrollPane(); Button button3 = new Button("Inside"); button3.setPrefWidth(120.0); button3.setPrefHeight(120.0); scrollView3.setContent(button3); scrollView3.setTranslateX(10); scrollView3.setTranslateY(180); //scrollView3.setManaged(false); scrollView3.setPrefWidth(60); scrollView3.setPrefHeight(60); scrollView3.setPannable(true); scrollView3.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); scrollView3.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); 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(75); label3.setTranslateY(180); Scene scene = new Scene(new Group(), w, h); ((Group) scene.getRoot()).getChildren().clear(); ((Group) scene.getRoot()).getChildren().addAll(FXCollections.observableArrayList(scrollView1, label1, scrollView2, label2, scrollView3, label3)); stage.setScene(scene); stage.show(); scrollView1.requestFocus(); } }