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

Modena doesn't center text in buttons like Caspian does.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Environment:

      Java 1.8.0ea b82

      Description

      I have code similar to the below test case that equalizes the sizing of buttons. In Caspian the text in buttons that have extra room is centered. In Modena the text in the same buttons is left aligned which doesn't seem very standard for a button control.

      Here is a simple test case that illustrates the issue.



      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.Region;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.VBox;
      import javafx.scene.paint.Color;
      import javafx.stage.Stage;


      public class ButtonTest extends Application {

      @Override
      public void start(Stage primaryStage) throws Exception {

      setUserAgentStylesheet(STYLESHEET_MODENA);
      primaryStage.setWidth(600);
      primaryStage.setHeight(400);
      primaryStage.centerOnScreen();

      Button btnAdd = new Button("Add");
      Button btnDelete = new Button("Delete");
      Button btnMoveUp = new Button("Move Up");
      Button btnMoveDown = new Button("Move Down");

      btnAdd.setMaxWidth(Double.MAX_VALUE);
      btnDelete.setMaxWidth(Double.MAX_VALUE);
      btnMoveUp.setMaxWidth(Double.MAX_VALUE);
      btnMoveDown.setMaxWidth(Double.MAX_VALUE);

      VBox vbButtons = new VBox();
      vbButtons.setSpacing(10);
      vbButtons.getChildren().addAll(btnAdd, btnDelete, btnMoveUp, btnMoveDown);
      vbButtons.setPrefWidth(Region.USE_COMPUTED_SIZE);
      vbButtons.setMaxWidth(Region.USE_PREF_SIZE);
      vbButtons.setPrefHeight(Region.USE_COMPUTED_SIZE);
      vbButtons.setMaxHeight(Region.USE_PREF_SIZE);

      StackPane border = new StackPane(vbButtons);

      primaryStage.setScene( new Scene(border, Color.WHITESMOKE));
      primaryStage.show();

      }

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

      }

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              csmithjfx Charles Smith (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved:
                Imported: