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

Modifiers not set for KEY_TYPED events on win32

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.1.8
    • Fix Version/s: 1.1.8
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.1.8
    • CPU:
      generic
    • OS:
      generic, windows_nt
    • Verification:
      Verified

      Backports

        Description

        This is a regression introduced in win32 JDK 1.1.8 build F. The test case works fine on WinNT using 1.1.8 build E and 1.1.7B. As far as I can tell, the test does not pass on Solaris for any 1.1 version of the JDK (see e.g. 4174399).

        import java.awt.*;
        import java.awt.event.*;

        public class ModifierTest extends Frame implements KeyListener {

            public static void main(String args[]) {
                new ModifierTest();
            }

            public ModifierTest() {
                TextArea ta = new TextArea(8, 30);
                ta.addKeyListener(this);
                add(ta);
                pack();
                show();
            }

            public void keyPressed(KeyEvent evt) { }
            public void keyReleased(KeyEvent e) { }

            public void keyTyped(KeyEvent evt) {
                char keyChar = evt.getKeyChar();
                System.out.println("Key event = " + evt);
                System.out.println("Key mods = " + KeyEvent.getKeyModifiersText(evt.get
        Modifiers()));
                if ( evt.isShiftDown() ) {
                    System.out.println("Shift key is down");
                }
                if ( evt.isControlDown()) {
                    System.out.println("Control key is down");
                }
                if ( evt.isAltDown() ) {
                    System.out.println("Alt key is down");
                }
                if ( evt.isMetaDown() ) {
                    System.out.println("Meta key is down");
                }
            }

        }

        Example output from WinNT 4.0 SP3 when pressing Shift-A:

        D:\KeyTest\reg>C:\jdk118F-bin\jdk1.1.8\bin\java -classpath C:\jdk118F-bin\jdk1.1
        .8\lib\classes.zip;. ModifierTest
        Key event = java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar='A'] on text0
        Key mods =

        D:\KeyTest\reg>C:\jdk118E-bin\jdk1.1.8\bin\java -classpath C:\jdk118E-bin\jdk1.1
        .8\lib\classes.zip;. ModifierTest
        Key event = java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar='A',modifiers=Sh
        ift] on text0
        Key mods = Shift
        Shift key is down

        stuart.lawrence@eng 1999-02-08

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                uwesunw Uwe Uwe (Inactive)
                Reporter:
                slawson Stuart Lawson
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: