-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b03
-
x86
-
windows_xp
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2142101 | 6-pool | Unassigned | P3 | Closed | Won't Fix |
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b94)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b94, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When switching from a Java application to another application using Alt-TAB, focus shifts to the JMenuBar. This means that when the user returns to the Java application, the menu bar has the focus, even if the user never intended to use the menu bar.
The problem only seems to occur when the time gap between hitting Alt and then TAB is short. Anything under about 0.5s on my system shifts focus to the menu bar and leaves the focus there.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Compile and run the sample program, which has a JFrame and JMenuBar
2) Quickly press Alt-TAB to switch to another application; make sure that the time gap between pressing Alt and TAB is small
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The menu bar on the Java application should not be highlighted.
ACTUAL -
The menu bar on the Java application is highlighted. After switching back to the application and then repeating the steps, the focus shift is undone, and now the menu bar is no longer highlighted.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN 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);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
A workaround posted in the comments to bug #4841881 (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4841881) works for the test case, but as the submitter mentioned, has potentially undesirable side effects. The workaround doesn't work for a larger application I have created. The problem existed in Java v.1.4.x, disappeared in v.1.5, and has reappeared in snapshots of v.1.6.
- backported by
-
JDK-2142101 Reopen #4841881: Alt tab with Windows L&F moves focus to the application menubar
-
- Closed
-
- relates to
-
JDK-4841881 Alt tab with Windows L&F moves focus to the application menubar
-
- Resolved
-
-
JDK-6595651 Focus transfers broken for applications embedding AWT across processes
-
- Resolved
-
-
JDK-6502358 REG: Iconifying and restoring the frame programmatically takes the focus off the initial component
-
- Closed
-
-
JDK-6539458 JPopupMenu does not display if invoker is instance of JWindow
-
- Closed
-
-
JDK-6689567 Not able to switch focus between two frames of the same Java application using q
-
- Open
-
-
JDK-6506966 COMPATIBILITY: Can't use the keypad to simulate game actions
-
- Closed
-
-
JDK-6469096 requestFocusXXX on unfocused window causes incorrect results under X
-
- Closed
-
-
JDK-6526971 6458497 still reproducible with 7.0 b06 and b07
-
- Closed
-
-
JDK-7121442 Regression : Reopen CR 6458497 still reproducible using JDK 7.
-
- Closed
-