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

Keyboard focus is lost in Swing application after switching to window

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      This is a problem shared between Java >=1.6 and the ion3 window manager.
      In combination, a Swing application which has keyboard focus on a field will lose it if you change to other window and return back to the first one. Then, no key works until you click again on any field.

      This happens prominently with Netbeans 6.5 (all editors are blocked) but also with a simple program like this one:

      --- TypeInSwing.java ----------------------------------------

      import javax.swing.JFrame;
      import javax.swing.JTextField;

      public class TypeInSwing {
        public static void main(String[] args) {
          JFrame frame = new JFrame("HelloWorldSwing");
          final JTextField field = new JTextField("type here");

          frame.getContentPane().add(field);

          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.pack();
          frame.setVisible(true);
        }
      }

      --------------------------------------------------------------


        To reproduce the bug:
      1. Install in GNU/Linux the ion3 window manager (both 20080207-2 from Ubuntu or the latest version, 20090110, works. You can run it without installing via http://modeemi.fi/~tuomov/dl/Ion3.xml
      2. Learn to move between tabs with the keyboard. I think the default is Alt+K N for next and Alt+K P for previous.
      3. Run some programs so that you have more than one tab.
      4. Run that example program with Java 1.6 or 1.7.
      5. Click on the text field and type; it works.
      6. In ion's tab bar, select another tab (either with mouse or with keyboard).
      7. Select the example program's tab again (either with mouse or with keyboard).
      8. Try to continue typing, but it doesn't work. The cursor is nowhere. You must click again in the editor.

      In my tests I saw:
      - another window manager (ex: icewm) doesn't show this problem: the focus isn't lost. This with Java 1.6
      - but in ion3, Java 1.4 and Java 1.5 also don't show this problem.
      - Affected: Java 1.6.0_06 on Ubuntu, Java 1.6.0_10 on Debian, OpenJDK 1.6.0_0-b11 Debian, Java 1.7.0-ea-b43 Debian.
      - Not affected: sun-java5-bin on Debian Etch, gij/libgcj 1.4.2 (4.0.2), 1.5.0_16-b02 on Debian

      This may be a regression in Java 1.6 or a bug in ion3.



      REPRODUCIBILITY :
      This bug can be reproduced always.

      Release Regression From : 5.0
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

        Attachments

          Activity

            People

            • Assignee:
              dcherepanov Dmitry Cherepanov
              Reporter:
              igor Igor Nekrestyanov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: