171 |
|
|
172 |
if (e.id == FocusEvent.FOCUS_GAINED) |
if (e.id == FocusEvent.FOCUS_GAINED) |
173 |
{ |
{ |
174 |
if (((FocusEvent) e).isTemporary ()) |
if (! (target instanceof Window)) |
175 |
setGlobalFocusOwner (target); |
{ |
176 |
else |
if (((FocusEvent) e).isTemporary ()) |
177 |
setGlobalPermanentFocusOwner (target); |
setGlobalFocusOwner (target); |
178 |
} |
else |
179 |
else if (e.id == FocusEvent.FOCUS_LOST) |
setGlobalPermanentFocusOwner (target); |
180 |
{ |
} |
181 |
// We need to set the window's focus owner here; we can't |
|
182 |
// set it when the window loses focus because by that time |
// Keep track of this window's focus owner. |
|
// the previous focus owner has already lost focus |
|
|
// (FOCUS_LOST events are delivered before |
|
|
// WINDOW_LOST_FOCUS events). |
|
183 |
|
|
184 |
// Find the target Component's top-level ancestor. |
// Find the target Component's top-level ancestor. |
185 |
Container parent = target.getParent (); |
Container parent = target.getParent (); |
192 |
(Window) target : (Window) parent; |
(Window) target : (Window) parent; |
193 |
|
|
194 |
Component focusOwner = getFocusOwner (); |
Component focusOwner = getFocusOwner (); |
195 |
if (focusOwner != null) |
if (focusOwner != null |
196 |
|
&& ! (focusOwner instanceof Window)) |
197 |
toplevel.setFocusOwner (focusOwner); |
toplevel.setFocusOwner (focusOwner); |
198 |
|
} |
199 |
|
else if (e.id == FocusEvent.FOCUS_LOST) |
200 |
|
{ |
201 |
if (((FocusEvent) e).isTemporary ()) |
if (((FocusEvent) e).isTemporary ()) |
202 |
setGlobalFocusOwner (null); |
setGlobalFocusOwner (null); |
203 |
else |
else |