-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
7, 8
-
generic, x86
-
linux_ubuntu, os_x
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'
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'
- duplicates
-
JDK-7156393 [macosx] Mnemonics don't work
- Open
- relates to
-
JDK-7112925 [macosx] closed/javax/swing/JTabbedPane/4624207/bug4624207.java fails on MacOS
- Resolved