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

[HBox] Alignment behaviour changed when Pos.BASELINE_CENTER is used.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Environment:

      jdk 1.8.0-ea-b57

      Description

      To reproduce run the app. And look at the screenshots:

      import javafx.application.Application;
      import javafx.geometry.HPos;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.CheckBox;
      import javafx.scene.control.CheckBoxBuilder;
      import javafx.scene.control.Label;
      import javafx.scene.control.RadioButton;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.control.Separator;
      import javafx.scene.control.SeparatorBuilder;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.VBox;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      public class JavaApplication28 extends Application
      {

          public static void main(String[] args)
          {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception
          {
              HBox hbox = new HBox(10d);
              hbox.getChildren().add(getScrollPane());

              Separator sep = SeparatorBuilder.create().halignment(HPos.CENTER).build();
              sep.setPrefWidth(80);
              hbox.getChildren().add(sep);


              CheckBox checkBox = CheckBoxBuilder.create()
                      .text("Check box the first line" + "\nthe sec long line" + "\nthe third line")
                      .graphic(new Rectangle(20, 20, Color.web("lightblue")))
                      .focusTraversable(false)
                      .build();
              hbox.getChildren().add(checkBox);
              hbox.setAlignment(Pos.BASELINE_CENTER);

              Scene scene = new Scene(hbox, 600, 400);
              stage.setScene(scene);
              stage.show();
          }

          private ScrollPane getScrollPane()
          {
              ScrollPane pane = new ScrollPane();
              HBox hbox = new HBox(30);
              VBox vbox1 = new VBox(10);
              vbox1.getChildren().addAll(new Label("one"), new Button("two"), new CheckBox("three"), new RadioButton("four"), new Label("five"));
              VBox vbox2 = new VBox(10);
              vbox2.getChildren().addAll(new Label("one"), new Button("two"), new CheckBox("three"), new RadioButton("four"), new Label("five"));
              hbox.getChildren().addAll(vbox1, vbox2);
              pane.setContent(hbox);
              pane.setFocusTraversable(false);
              return pane;
          }
      }

        Attachments

          Activity

            People

            Assignee:
            msladecek Martin Sládeček
            Reporter:
            dzinkevi Dmitry Zinkevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: