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

Keyboard layout didn't keep its state if it was changed when dialog was active

XMLWordPrintable

    • b27
    • x86_64
    • windows

        A DESCRIPTION OF THE PROBLEM :
        Similar problem with JDK-8187635, but different scenario. In this case, keyboard layout is changed when a dialog is active. After the dialog is closed, the keyboard layout will revert to previous layout.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        - Run sample code.
        - Click one of the button, a dialog will appear.
        - Change keyboard layout (i.e from English to Russia).
        - Close the dialog, and keyboard layout will revert to English.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Keyboard layout keep its state.
        ACTUAL -
        Keyboard layout revert to previous before it was changed.

        ---------- BEGIN SOURCE ----------
        public static void main(String[] args) {
                SwingUtilities.invokeLater(() -> {
                    JFrame jFrame = new JFrame("Test");

                    JDialog dialog = new JDialog(jFrame, "dialog", true);
                    dialog.setSize(new Dimension(100,100));
                    JButton button1 = new JButton();
                    button1.setText("dialog");
                    button1.addActionListener(e -> dialog.setVisible(true));

                    JButton button2 = new JButton();
                    button2.setText("option");
                    button2.addActionListener(e -> JOptionPane.showMessageDialog(jFrame, "optionPane"));

                    JPanel panel = new JPanel();
                    panel.add(button1);
                    panel.add(button2);

                    jFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                    jFrame.add(panel);
                    jFrame.setSize(new Dimension(300, 100));
                    jFrame.setVisible(true);
                });
            }
        ---------- END SOURCE ----------

        FREQUENCY : always


          1. AppTest.java
            1 kB
            Praveen Narayanaswamy

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

                Created:
                Updated:
                Resolved: