package bugs;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class TestScrollPaneRT39755Simplified 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(120);
        primaryStage.setHeight(120);

        primaryStage.setScene(scene);
        primaryStage.show();
        root.getChildren().add(createPanel());
    }

    int ind = 0;
    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 < 5; i++) {
            vb.getChildren().add(new Label("This is test label #" + ind++));
        }
        sp.setStyle(STYLE);
        return sp;
    }

}