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

[macosx] Mnemonic doesn't work in JTabbedPane

    XMLWordPrintable

Details

    • generic, x86
    • linux_ubuntu, os_x

    Description

      Regression. Last times work in b226.

      See regression test javax/swing/JTabbedPane/4624207/bug4624207.java
      To reproduce the issue run the code and press Ctrl+Alt+a:
      ------------------------------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class MyKeyTest {

          static JPanel panel;

          public static void main(String[] args) throws Exception {
              SwingUtilities.invokeAndWait(new Runnable() {

                  public void run() {
                      JFrame frame = new JFrame("Test Frame");
                      frame.setSize(300, 200);
                      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                      panel = new JPanel();
                      panel.addKeyListener(new KeyAdapter() {

                          @Override
                          public void keyPressed(KeyEvent e) {
                              System.out.println("[key listener]");
                              System.out.println("key code: " + e.getKeyCode());
                              System.out.println("key char: " + e.getKeyChar());
                              System.out.println("key char int: " + (int) e.getKeyChar());
                          }
                      });
                      frame.getContentPane().add(panel, BorderLayout.CENTER);
                      panel.requestFocus();
                      frame.setVisible(true);
                  }
              });

              SwingUtilities.invokeAndWait(new Runnable() {

                  public void run() {
                      panel.requestFocus();
                  }
              });
          }

      }
      ------------------------------

      The result after pressing Ctrl+Alt+a is:
      ------------------------------
      [key listener]
      key code: 65
      key char:
      key char int: 1
      ------------------------------
      The key char is 1 instead of 'a'

      Attachments

        Issue Links

          Activity

            People

              alexsch Alexandr Scherbatiy
              pealexan Petrov Alexander (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: