package bugs; import javafx.application.Application; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.ScrollPane; import javafx.scene.layout.HBox; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class TestScrollPaneRT39755 extends Application { private final String STYLE = "" + "-fx-alignment: center;" + "-fx-border-color: black;" + "-fx-border-width: 2;" + "-fx-border-radius: 8;" + "-fx-padding: 3;" + "-fx-text-wrap: true;"; VBox root = new VBox(); Scene scene = new Scene(root); public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setWidth(800); primaryStage.setHeight(600); primaryStage.setScene(scene); primaryStage.show(); root.getChildren().add(createPanel()); } int ind = 0; private Node createBlock() { HBox blk = new HBox(5); blk.setStyle(STYLE); for (int i = 0; i < 6; i++) { Label l = new Label("This is label #" + ind++); l.setStyle(STYLE); blk.getChildren().add(l); } return blk; } private ScrollPane createPanel() { ScrollPane sp = new ScrollPane(); VBox.setVgrow(sp, Priority.ALWAYS); VBox vb = new VBox(10); sp.setContent(vb); for (int i = 0; i < 20; i++) { vb.getChildren().add(createBlock()); } sp.setStyle(STYLE); return sp; } }