-
Bug
-
Resolution: Unresolved
-
P3
-
7, 8, 9
The section "Event Delivery" of "The AWT Focus Subsystem" specification needs a clarification.
Current spec (http://docs.oracle.com/javase/7/docs/api/java/awt/doc-files/FocusSpec.html#EventDelivery) says:
"If the focus is not in java application and the user clicks on a focusable child Component a of an inactive Frame b, the following events will be dispatched and handled in order:
b will receive a WINDOW_ACTIVATED event.
Next, b will receive a WINDOW_GAINED_FOCUS event.
Finally, a will receive a FOCUS_GAINED event.
If the user later clicks on a focusable child Component c of another Frame d, the following events will be dispatched and handled in order:
a will receive a FOCUS_LOST event.
b will receive a WINDOW_LOST_FOCUS event.
b will receive a WINDOW_DEACTIVATED event.
d will receive a WINDOW_ACTIVATED event.
d will receive a WINDOW_GAINED_FOCUS event.
c will receive a FOCUS_GAINED event."
It's necessary to specify explicitly that the observable event sequence can contain not only events described above, but also other events. For example, pairs of temporary focus events.
Test code:
Frame f = new Frame("f");
f.setLayout(new FlowLayout());
Button b1 = new Button("b1");
Button b2 = new Button("b2");
f.add(b1);
f.add(b2);
f.pack();
f.setVisible(true);
How to reproduce:
1. After showing a window, click outside the window
2. Click on b2.
Observed event list order:
1) WINDOW_ACTIVATED on "f"
2) WINDOW_GAINED_FOCUS on "f"
3) FOCUS_GAINED on "b1"
4) FOCUS_LOST on "b1"
5) FOCUS_GAINED on "b2"
Here we see a pair of temporary focus events (FOCUS_GAINED on "b1", FOCUS_LOST on "b1"), that are not described in the spec.
Current spec (http://docs.oracle.com/javase/7/docs/api/java/awt/doc-files/FocusSpec.html#EventDelivery) says:
"If the focus is not in java application and the user clicks on a focusable child Component a of an inactive Frame b, the following events will be dispatched and handled in order:
b will receive a WINDOW_ACTIVATED event.
Next, b will receive a WINDOW_GAINED_FOCUS event.
Finally, a will receive a FOCUS_GAINED event.
If the user later clicks on a focusable child Component c of another Frame d, the following events will be dispatched and handled in order:
a will receive a FOCUS_LOST event.
b will receive a WINDOW_LOST_FOCUS event.
b will receive a WINDOW_DEACTIVATED event.
d will receive a WINDOW_ACTIVATED event.
d will receive a WINDOW_GAINED_FOCUS event.
c will receive a FOCUS_GAINED event."
It's necessary to specify explicitly that the observable event sequence can contain not only events described above, but also other events. For example, pairs of temporary focus events.
Test code:
Frame f = new Frame("f");
f.setLayout(new FlowLayout());
Button b1 = new Button("b1");
Button b2 = new Button("b2");
f.add(b1);
f.add(b2);
f.pack();
f.setVisible(true);
How to reproduce:
1. After showing a window, click outside the window
2. Click on b2.
Observed event list order:
1) WINDOW_ACTIVATED on "f"
2) WINDOW_GAINED_FOCUS on "f"
3) FOCUS_GAINED on "b1"
4) FOCUS_LOST on "b1"
5) FOCUS_GAINED on "b2"
Here we see a pair of temporary focus events (FOCUS_GAINED on "b1", FOCUS_LOST on "b1"), that are not described in the spec.
- relates to
-
JDK-8032579 Incorrect FocusTraversalPolicy with mixed AWT/Swing toplevels
-
- Closed
-