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

[macosx] Functional keys greater than F20 don't work as a menu shortcut

XMLWordPrintable

      FULL PRODUCT VERSION :
      This is a build of the next workspace
      http://hg.openjdk.java.net/jdk7u/jdk7u40

      + webrev for 8019265 has been applied

      denis@/export/wsps/jdk7u40>hg summary
      parent: 703:a1ae13479e87 tip
      Added tag jdk7u40-b33 for changeset 3fdfe7f1b063

      openjdk version " 1.7.0-internal "
      OpenJDK Runtime Environment (build 1.7.0-internal-denis_2013_07_12_14_24-b00)
      OpenJDK 64-Bit Server VM (build 24.0-b52, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      OS X 10.8.4 (12E55)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
        Model Name:Mac mini
        Model Identifier:Macmini6,2
        Processor Name:Intel Core i7

      A DESCRIPTION OF THE PROBLEM :
      Despite the fact that the fix for 8019265 works brilliant , it still does not covers some cases.

      REGRESSION. Last worked in version 6u45

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the attached source code.
      2. Use Up/Down arrows keys. You should notice that ItemEvents and ActionEvents are received.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      We do not press F24 and arrow key is not an accelerator, so we should not receive any notifications.
      ACTUAL -
      We are notified in ActionListener and ItemListener.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      class SimpleEditor extends JFrame {

          private final JTextArea textArea = new JTextArea(60, 30);

          private SimpleEditor() throws HeadlessException {
              super( " Simple editor " );

              System.setProperty( " apple.laf.useScreenMenuBar " , " true " );
              textArea.setText( " First
      Second
      PLACE CARET HERE
      Fourth
      Fifth " );
              textArea.setCaretPosition( " First
      Second
      PLACE " .length());
              add(textArea);
              JMenuBar mb = new JMenuBar();
              JMenu firstMenu = new JMenu( " FirstMenu " );
              JCheckBoxMenuItem firstMenuItem = new JCheckBoxMenuItem( " FirstItem " );

              firstMenu.add(firstMenuItem);
              mb.add(firstMenu);
              setJMenuBar(mb);
              pack();
              setVisible(true);

              KeyStroke ctrlShiftUp = KeyStroke.getKeyStroke( " shift meta DOWN " );

              firstMenuItem.setAccelerator(ctrlShiftUp);

              firstMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F24,0));

              firstMenuItem.addActionListener(new ActionListener() {
                    @Override
                  public void actionPerformed(ActionEvent e) {
                      System.err.println( " Action on menu item " );
                  }
              });

              firstMenuItem.addItemListener(new ItemListener() {
                  @Override
                  public void itemStateChanged(ItemEvent e) {
                      System.err.println(e);
                  }
              });
          }

          public static void main(String[] args) {
              SwingUtilities.invokeLater(new Runnable() {
                  @Override
                  public void run() {
                      new SimpleEditor();

                  }
              });
          }
      }

      ---------- END SOURCE ----------

            pchelko Petr Pchelko (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: