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

Mnemonics on CheckBoxes and RadioButtons should actually trigger them

    Details

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

      Tested under both Linux and Windows

      Description

      Mnemonics on checkboxes (and radio buttons) do not work as expected. Consider this example:
         import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.CheckBox;
      import javafx.scene.layout.GridPane;
      import javafx.stage.Stage;

      public class MnemonicTest extends Application {

      @Override
      public void start(Stage primaryStage) throws Exception {
      GridPane grid = new GridPane(); grid.setVgap(10);

      CheckBox cb1 = new CheckBox("Option _A"); cb1.setMnemonicParsing(true); cb1.setFocusTraversable(false);
      CheckBox cb2 = new CheckBox("Option _B"); cb2.setMnemonicParsing(true);
      CheckBox cb3 = new CheckBox("Option _C"); cb3.setMnemonicParsing(true);
      Button execute = new Button("_Go!"); execute.setMnemonicParsing(true);
      execute.setOnAction((ActionEvent e) -> {
      System.out.println(cb1.isSelected() + ", " + cb2.isSelected() + ", " + cb3.isSelected());
      });

      grid.add(cb1, 0, 1);
      grid.add(cb2, 0, 2);
      grid.add(cb3, 0, 3);
      grid.add(execute, 0, 4);

      Scene scene = new Scene(grid);
      primaryStage.setScene(scene);
      primaryStage.show();
      }

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

      }

      If you start this application and press Alt+A, Option A should be checked. Nothing happens.
      When you press Alt+B, Option B is focussed (but not selected)

      Activating the mnemonic should actually trigger the control (regardless of focus traversability).

      Pressing Alt+G correctly fires the button.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rlichtenbjfx Robert Lichtenberger (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: