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

Button with Mnemonic is wider than one without

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • tbd
    • 8u5
    • javafx
    • OSX

      If you look at the following code, visually the text is exactly the same but one of them has a mnemonic. The one with the mnemonic is wider when it should be the same width.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.FlowPane;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class ButtonWidthTest extends Application {
          @Override
          public void start(Stage stage) throws Exception {
              FlowPane pane = new FlowPane();
              Scene scene = new Scene(pane, 500, 500);
              stage.setScene(scene);

              VBox vBox = new VBox();
              Button button1 = new Button("1:Fields");
              Button button2 = new Button("_1:Fields");
              button2.setMnemonicParsing(true);

              vBox.getChildren().addAll(button1, button2);

              pane.getChildren().add(vBox);
              stage.show();
          }

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

            aghaisas Ajit Ghaisas
            ndarcy Nick D'Arcy
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: