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

Not able to switch focus between two frames of the same Java application using q

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 6u5
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description

      OPERATING SYSTEM(S)
      -------------------
      All

      FULL JDK VERSION(S)
      -------------------
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b25)
      Java HotSpot(TM) Client VM (build 12.0-b01, mixed mode)

      java version "1.6.0_05"
      Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode)

      java version "1.5.0_15"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
      Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode)

      DESCRIPTION
      -----------
      In any look-and-feel and on any platform, quick Alt-Tab does not switch focus between two frames of the same Java application properly under certain circumstances (the example described here is when the application menu has the focus).

      The problem seems similar to 6458497, and may be related, but I could not find any existing bug for the exact issue described in this report.

      RECREATION INSTRUCTIONS
      -----------------------
      1. Compile and launch the sample code given below. Two windows will come up.
      2. Click on the Menu of the currently active window.
      3. Try to switch focus between two windows using quick Alt-Tab.
      4. Focus shifts to the other frame.
      5. Use quick Alt-Tab again to switch focus.

      Observed result:
      Focus stays in the same window.

      Expected result:
      Focus should shift to the other window.

      The behaviour is not completely consistent, but it seems that two quick Alt-Tab presses usually makes the focus shift to the other window.

      TESTCASE SOURCE
      ---------------
      import java.awt.*;
      import javax.swing.*;

      public class AltTab {
        public static void main(String[] args) {
          try {
              UIManager.setLookAndFeel(UIManager
                   .getSystemLookAndFeelClassName());
          } catch(Exception e) {
          }

          JFrame frame = new JFrame("Alt-Tab Frame");
          JMenuBar menuBar = new JMenuBar();
          frame.setJMenuBar(menuBar);
          JMenu fileMenu = new JMenu("File");

          char fileMenuMnemonic = 'F';
          fileMenu.setMnemonic(fileMenuMnemonic);
          menuBar.add(fileMenu);
          frame.setSize(100,100);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);

          JFrame frame1 = new JFrame("Alt-Tab Frame");
          JMenuBar menuBar1 = new JMenuBar();
          frame1.setJMenuBar(menuBar1);
          JMenu fileMenu1 = new JMenu("File");

          char fileMenuMnemonic1 = 'F';
          fileMenu1.setMnemonic(fileMenuMnemonic1);
          menuBar1.add(fileMenu1);
          frame1.setSize(100,100);
          frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame1.setVisible(true);
        }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                art Artem Ananiev
                Reporter:
                dkorbel David Korbel (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: