Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8127196

BorderPane right element ignoring preferred height (and also width), regression?



      See code below.

      I'm putting a VBox on the right side of a BorderPane. In JavaFX 2.0, this VBox would be sized as small as possible (both width and height), however, in JavaFX 2.1, two potential issues are causing the VBox to be maxed in both the width and height.

      First, the Preferred Height of the VBox apparently is ignored, despite the docs for BorderPane saying that it will use the preferred height. This results in the VBox taking up max height, while in 2.0 it was taking up only a fraction of that.

      Secondly, when giving any of the labels inside the VBox "setWrapText(true)", the entire VBox becomes maximized in the horizontal direction. I would prefer it would use the setMaxWidth of the label with setWrapText(true) and then wrap lines accordingly.

      The test code below:

      import javafx.application.Application;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.control.ProgressIndicator;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class BorderPaneTest extends Application {
        public static void main(String[] args) {

        public void start(Stage stage) throws Exception {
          BorderPane borderPane = new BorderPane();

          Scene scene = new Scene(borderPane);

          VBox vBox = new VBox() {{
            setStyle(" -fx-background-color: rgba(0,0,0,0.5); -fx-background-radius: 0 0 0 15; ");
            getChildren().add(new StackPane() {{
              getChildren().add(new VBox() {{
                getChildren().add(new HBox() {{
                  getChildren().add(new ProgressIndicator() {{
                  getChildren().add(new Label() {{
                    setText("My Title");
                getChildren().add(new Label() {{
                  setText("My Somewhat longer description");
      // setWrapText(true);





          Issue Links



              • Assignee:
                ekrejcir Eva Krejčířová (Inactive)
                jhendrikx John Hendrikx
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: