-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b04
-
x86
-
linux
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2143945 | 6u1 | Yuri Nesterenko | P3 | Resolved | Fixed | b05 |
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b104)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b104, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux wssta 2.6.17 #1 SMP Wed Oct 25 13:19:14 CEST 2006 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
We are developing a Java application that must run under Linux and need to support the left and right "Windows" keys and the "Context Menu" key.
Unfortunately the returned keyCode is always "0" for these keys.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the included test case under Linux.
Focus the test application window.
Press the left and right windows keys and the context menu key.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The reported keyCodes should have been identical to the keyCodes reported when running the test application under Windows (windows = 524, context menu = 525)
ACTUAL -
The reported keyCode is always "0" when running the test application under Linux.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
public class NewJFrame extends javax.swing.JFrame implements KeyEventDispatcher {
private Document document;
public NewJFrame() {
initComponents();
document = textArea.getDocument();
KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyboardFocusManager.addKeyEventDispatcher(this);
String javaVersion = System.getProperty("java.version");
textArea.setText("Java Version: " + javaVersion + "\n");
}
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
scrollPane = new javax.swing.JScrollPane();
textArea = new javax.swing.JTextArea();
clearButton = new javax.swing.JButton();
getContentPane().setLayout(new java.awt.GridBagLayout());
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
textArea.setColumns(20);
textArea.setEditable(false);
textArea.setRows(5);
scrollPane.setViewportView(textArea);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
getContentPane().add(scrollPane, gridBagConstraints);
clearButton.setText("Clear");
clearButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
getContentPane().add(clearButton, gridBagConstraints);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-768)/2, (screenSize.height-337)/2, 768, 337);
}
private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {
textArea.setText(null);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
int length = document.getLength();
try {
document.insertString(length, keyEvent.paramString() + "\n", null);
} catch (BadLocationException ex) {
ex.printStackTrace();
}
return false;
}
private javax.swing.JButton clearButton;
private javax.swing.JScrollPane scrollPane;
private javax.swing.JTextArea textArea;
}
---------- END SOURCE ----------
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b104)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b104, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux wssta 2.6.17 #1 SMP Wed Oct 25 13:19:14 CEST 2006 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
We are developing a Java application that must run under Linux and need to support the left and right "Windows" keys and the "Context Menu" key.
Unfortunately the returned keyCode is always "0" for these keys.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the included test case under Linux.
Focus the test application window.
Press the left and right windows keys and the context menu key.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The reported keyCodes should have been identical to the keyCodes reported when running the test application under Windows (windows = 524, context menu = 525)
ACTUAL -
The reported keyCode is always "0" when running the test application under Linux.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
public class NewJFrame extends javax.swing.JFrame implements KeyEventDispatcher {
private Document document;
public NewJFrame() {
initComponents();
document = textArea.getDocument();
KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyboardFocusManager.addKeyEventDispatcher(this);
String javaVersion = System.getProperty("java.version");
textArea.setText("Java Version: " + javaVersion + "\n");
}
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
scrollPane = new javax.swing.JScrollPane();
textArea = new javax.swing.JTextArea();
clearButton = new javax.swing.JButton();
getContentPane().setLayout(new java.awt.GridBagLayout());
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
textArea.setColumns(20);
textArea.setEditable(false);
textArea.setRows(5);
scrollPane.setViewportView(textArea);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 0, 5);
getContentPane().add(scrollPane, gridBagConstraints);
clearButton.setText("Clear");
clearButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
clearButtonActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0);
getContentPane().add(clearButton, gridBagConstraints);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-768)/2, (screenSize.height-337)/2, 768, 337);
}
private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {
textArea.setText(null);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
}
});
}
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
int length = document.getLength();
try {
document.insertString(length, keyEvent.paramString() + "\n", null);
} catch (BadLocationException ex) {
ex.printStackTrace();
}
return false;
}
private javax.swing.JButton clearButton;
private javax.swing.JScrollPane scrollPane;
private javax.swing.JTextArea textArea;
}
---------- END SOURCE ----------
- backported by
-
JDK-2143945 Special keys are not supported under Linux
-
- Resolved
-
- relates to
-
JDK-2146417 Since JDK 6.0 in XAWT, Ctrl+ascii letter results in KEY_TYPED ascii letter, not control char
-
- Resolved
-