-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b64
-
sparc
-
solaris_10
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2179470 | 6u21 | Yuri Nesterenko | P3 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
SunOS dev-d01 5.10 Generic_127111-09 sun4u sparc SUNW,Sun-Fire-V440
EXTRA RELEVANT SYSTEM CONFIGURATION :
Window Manager: fvwm
A DESCRIPTION OF THE PROBLEM :
Under solaris with fvwm as the window manager, pressing any of the Number pad keys that have dual function, i.e. 7 - Home, 4 - Left, while Num Lock is on causes multiple KeyEvents are created. Essently, by pressing the num key 4, the cursor moves back one space and inserts a 4 instead of only inserting the number 4. When Num Lock is off, the keys have the correct behavior, no extra KeyEvents are created.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a new JTextField making sure your window manager is fvwm.
When the screen comes up, make sure Num Lock is ON and try to enter data using the num pad. You should see each key producing odd behavior and multiple KeyEvents being created.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You would expect that with Num Lock on the numbers would only insert the number.
ACTUAL -
Each key that has different functionally when Num Lock is off performs both functions with Num Lock on.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
public class TextKeyPadInput extends javax.swing.JPanel implements KeyListener {
public static void main(String args[]) {
JFrame main = new JFrame("Test Key Input");
main.add(new TextKeyPadInput());
main.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
main.pack();
main.setVisible(true);
}
public TextKeyPadInput() {
initComponents();
jTextField1.addKeyListener(this);
}
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jTextField1 = new javax.swing.JTextField();
jTextField1.setColumns(10);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(100, 100, 100)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(216, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(62, 62, 62)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(219, Short.MAX_VALUE))
);
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JTextField jTextField1;
// End of variables declaration
public void keyTyped(KeyEvent e) {}
public void keyPressed(KeyEvent e) {
System.out.println("Key Pressed: " + e.getKeyCode() + ", " + e.getKeyChar() + ", " + KeyEvent.getKeyText(e.getKeyCode()));
}
public void keyReleased(KeyEvent e) {}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The only workaround is to have on every text field a key listener that catches those inputs and changes them to what the user desired.
Java HotSpot(TM) Server VM (build 1.6.0_03-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
SunOS dev-d01 5.10 Generic_127111-09 sun4u sparc SUNW,Sun-Fire-V440
EXTRA RELEVANT SYSTEM CONFIGURATION :
Window Manager: fvwm
A DESCRIPTION OF THE PROBLEM :
Under solaris with fvwm as the window manager, pressing any of the Number pad keys that have dual function, i.e. 7 - Home, 4 - Left, while Num Lock is on causes multiple KeyEvents are created. Essently, by pressing the num key 4, the cursor moves back one space and inserts a 4 instead of only inserting the number 4. When Num Lock is off, the keys have the correct behavior, no extra KeyEvents are created.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a new JTextField making sure your window manager is fvwm.
When the screen comes up, make sure Num Lock is ON and try to enter data using the num pad. You should see each key producing odd behavior and multiple KeyEvents being created.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You would expect that with Num Lock on the numbers would only insert the number.
ACTUAL -
Each key that has different functionally when Num Lock is off performs both functions with Num Lock on.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
public class TextKeyPadInput extends javax.swing.JPanel implements KeyListener {
public static void main(String args[]) {
JFrame main = new JFrame("Test Key Input");
main.add(new TextKeyPadInput());
main.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
main.pack();
main.setVisible(true);
}
public TextKeyPadInput() {
initComponents();
jTextField1.addKeyListener(this);
}
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jTextField1 = new javax.swing.JTextField();
jTextField1.setColumns(10);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(100, 100, 100)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(216, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(62, 62, 62)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(219, Short.MAX_VALUE))
);
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JTextField jTextField1;
// End of variables declaration
public void keyTyped(KeyEvent e) {}
public void keyPressed(KeyEvent e) {
System.out.println("Key Pressed: " + e.getKeyCode() + ", " + e.getKeyChar() + ", " + KeyEvent.getKeyText(e.getKeyCode()));
}
public void keyReleased(KeyEvent e) {}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The only workaround is to have on every text field a key listener that catches those inputs and changes them to what the user desired.
- backported by
-
JDK-2179470 Numpad keys trigger more than one KeyEvent.
-
- Resolved
-