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

[HBox] HBox baseline alignment doesn't work with Buttons that have large explicit preferred size

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u20
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      Windows 7 64-bit
      Java 8 b129

      Description

      Add labels and a button to an HBox with alignment set to BASELINE_LEFT.
      Make the preferred size of the Button larger than normal.
      Text is not aligned to the baseline.

      See the following test case:

      package hboxalignment;

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

      public class HBoxAlignment extends Application {

      @Override
      public void start(Stage primaryStage) {
      Button tallButton = new Button("Tall button");
      tallButton.setPrefHeight(32);
      HBox hbox = new HBox(
      new Label("Label1"),
      new Label("Label2"),
      tallButton
      );

      hbox.setAlignment(Pos.BASELINE_LEFT);

      VBox vbox = new VBox(hbox);
      Scene scene = new Scene(vbox, 500, 250);

      primaryStage.setTitle("Hello World!");
      primaryStage.setScene(scene);
      primaryStage.show();
      }

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

      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              swpalmer Scott Palmer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Imported: