-
Bug
-
Resolution: Not an Issue
-
P2
-
None
-
7u4, 7u40, 7u51, 8, 8u20
-
generic
-
generic
In case an application uses Swing and AWT toplevels all together, and a Swing toplevel is initialised first then all subsequent AWT topleves get swing FocusTraversalPolicy, which is LayoutFocusTraversalPolicy. However, the correct default FTP for an AWT toplevel is DefaultFocusTraversalPolicy (unless a developer explicitly sets another FTP).
The test case:
import java.awt.Frame;
import javax.swing.JFrame;
public class FocusPolicyTest {
public static void main(String[] args) {
JFrame f0 = new JFrame("Swing");
f0.setVisible(true);
System.out.println("FTP for Swing: " + f0.getFocusTraversalPolicy());
Frame f1 = new Frame("AWT");
f1.setVisible(true);
System.out.println("FTP for AWT: " + f1.getFocusTraversalPolicy());
}
}
The test case:
import java.awt.Frame;
import javax.swing.JFrame;
public class FocusPolicyTest {
public static void main(String[] args) {
JFrame f0 = new JFrame("Swing");
f0.setVisible(true);
System.out.println("FTP for Swing: " + f0.getFocusTraversalPolicy());
Frame f1 = new Frame("AWT");
f1.setVisible(true);
System.out.println("FTP for AWT: " + f1.getFocusTraversalPolicy());
}
}
- relates to
-
JDK-8033249 Focus Event Delivery spec needs a clarification
-
- Open
-
-
JDK-7125044 [macosx] Test failure because Component.transferFocus() works differently in applet and application.
-
- Closed
-