-
Bug
-
Resolution: Fixed
-
P3
-
1.1.8, 1.2.0
-
b02
-
generic, sparc
-
generic, solaris_2.6
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2024065 | 1.3.0 | Eric Hawkes | P3 | Resolved | Fixed | beta |
Name: diC59631 Date: 12/01/98
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import com.sun.java.swing.JFrame;
import com.sun.java.swing.JTextField;
/** Modifiers (other than SHIFT) not delivered with KEY_TYPED.
*
* 1.2beta3 & 1.2beta4
* Solaris 2.6, BUT NOT WinNT
*
* In the Solaris environment, the ALT, CTRL, & META modifiers are
* never set in a KEY_TYPED KeyEvent for a Lightweight component.
* They are set in a WinNT environment.
*
* Consequently, ALT-a causes an "a" to be entered in the JTextField
* (& similar components) in the Solaris environment, but not with WinNT.
* Also, mnemonic and accelerator keystrokes are sometimes entered in these
* Components because of this. Also, there are other platform
* inconsistencies with KEY_TYPED when you combine modifiers.
*
* Note that the KeyEvent API doc,
* http://java.sun.com/products/jdk/1.2/docs/api/java/awt/event/KeyEvent.html
* and the "Writing a KeyListener" tutorial,
* http://java.sun.com/docs/books/tutorial/ui/components/keylistener.html,
* state that KEY_TYPED is used when a combination of characters maps to
* a Unicode character. So it is unclear whether a KEY_TYPED should be
* sent at all. (Since when does ALT-a map to Unicode "a"?)
*
* But at the very least, the Solaris behavior should change
* to match WinNT so that Components and Listeners can easily
* recognize normal character input.
*
* ###@###.###
*/
public class KeyEventDump implements KeyListener
{
public void keyPressed(KeyEvent e)
{
System.err.println(e);
}
public void keyTyped(KeyEvent e)
{
System.err.println(e);
}
public void keyReleased(KeyEvent e)
{
System.err.println(e);
}
public static void main(String args[])
{
JTextField text = new JTextField(10);
text.addKeyListener(new KeyEventDump());
JFrame frame = new JFrame();
frame.getContentPane().add(text);
frame.pack();
frame.show();
}
}
(Review ID: 36497)
======================================================================
- backported by
-
JDK-2024065 Modifiers not delivered with KEY_TYPED events on Solaris.
- Resolved
- duplicates
-
JDK-4220772 Key modifiers not passed for KEY_TYPED events on Solaris
- Closed
- relates to
-
JDK-4159610 Menu accelerator gets inserted into text
- Resolved
-
JDK-4301105 When tried ShortCut key alt+n, n was input in Text Area.
- Closed
-
JDK-4174399 KeyEvent modifiers not working on unix platforms
- Closed