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

On Windows Swing changes keyboard layout on a window activation

    Details

    • Subcomponent:
    • Resolved In Build:
      b05

      Backports

        Description

        On Windows Swing changes keyboard layout on a window activation

        If "Let me set a different input method for each app window" checkbox is disabled, Swing applications switch System keyboard layout to the layout they were started with.

        On Windows 10 you can find the checkbox at Control Panel -> Clock, Language and Region -> Language -> Advanced Settings -> "Let me set a different input method for each app window"

        To reproduce the problem, disable the checkbox.

        Add at least two languages at Control Panel -> Clock, Language and Region -> Language -> Change you language preferences
        For instance, you can add Russian and English languages

        Run the java app

        public class Test {
            public static void main(String[] args) {
                SwingUtilities.invokeLater(() -> {
                    JFrame jFrame = new JFrame("Test");
                   
                    jFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                    jFrame.setSize(new Dimension(200,200));
                    jFrame.add(new JTextArea());
                    jFrame.pack();
                    jFrame.setVisible(true);
                });
            }
        }

        Deactivate the Swing frame (click on the desktop or any other application window), change the input language.

        Activate the Swing frame again. Being activated the frame changes the input language system wide.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dmarkov Dmitry Markov
                  Reporter:
                  shadowbug Shadow Bug
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: