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

Shift or Capslock not working in Textfield after accented keystrokes

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Version:
    • Resolved In Build:
      b19
    • CPU:
      x86_64
    • OS:
      windows_7

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_161"
        Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
        Java HotSpot(TM) Client VM (build 25.161-b12, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        Windows 7 32-bits
        Windows 7 64-bits

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        French keyboard

        A DESCRIPTION OF THE PROBLEM :
        Shift or Capslock stop working in java.awt.Textfield, leading to severe text input issue.
        It always happens on Windows 7, either 32-bits ou 64-bits.



        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Send accentued keystrokes, whith keys combination like "ö ô ñ" to java.awt.Textfield
        Then, Shift or Capslock, Alt Gr don't work anymore in that Textfield.
        Also Control shorcuts behave incorrectly.

        Character "ù" doesn't trigger the bug as it's typed on a single key, on the french keyboard.


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Shifted keystrokes should be displayed in the Texfield.

        ACTUAL -
        It continue to works like if the Shift / Caps / Alt Gr key was not pressed, but it is.

        Also shorcuts like [Control]+[key] behave differently.
        For instance, Control+v pastes clipboard but also add an uneeded additionnal "v"



        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------

        import java.awt.Frame;
        import java.awt.TextField;
        import java.awt.event.*;

        public class TestKeysWin7 extends Frame implements WindowListener
        {
        MyField field;

            public static void main(String args[])
        {
        TestKeysWin7 app = new TestKeysWin7();
        }

        public TestKeysWin7()
        {
        field = new MyField();

        setVisible(true);
        add(field);
        setSize(800, 100);

        addWindowListener(this);
        }

            public void windowOpened(WindowEvent e) {}

            public void windowClosing(WindowEvent e)
        {
        System.exit(0);
            }

            public void windowClosed(WindowEvent e) {}

            public void windowIconified(WindowEvent e) {}

            public void windowDeiconified(WindowEvent e) {}

            public void windowActivated(WindowEvent e) {}

            public void windowDeactivated(WindowEvent e) {}
            
            
            public class MyField extends TextField implements KeyListener
        {
        public MyField()
        {
        addKeyListener(this);
        }

        public void keyPressed(KeyEvent e)
        {
        int code = e.getKeyCode();
        System.out.println("Pressed key [" + KeyEvent.getKeyText(code) + "]");
        }

        public void keyReleased(KeyEvent e)
        {
        int code = e.getKeyCode();
        System.out.println("Released key [" + KeyEvent.getKeyText(code) + "]");
        }

        public void keyTyped(KeyEvent e)
        {
        char ch = e.getKeyChar();
        int mod = e.getModifiers();

        if (mod > 0)
        {
        System.out.print("Typed keys [" + KeyEvent.getKeyModifiersText(mod) + "]");
        System.out.print(" char [" + ch + "]");
        System.out.println("");
        }
        else
        {
        System.out.println("Typed char [" + ch + "]");
        }
        }
        }
        }
        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                dmarkov Dmitry Markov
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: