269 }
270 }
271 return se.dispatched;
272 }
273
274 /**
275 * This method is called by the AWT event dispatcher requesting that the
276 * current KeyboardFocusManager dispatch the specified event on its behalf.
277 * DefaultKeyboardFocusManagers dispatch all FocusEvents, all WindowEvents
278 * related to focus, and all KeyEvents. These events are dispatched based
279 * on the KeyboardFocusManager's notion of the focus owner and the focused
280 * and active Windows, sometimes overriding the source of the specified
281 * AWTEvent. If this method returns <code>false</code>, then the AWT event
282 * dispatcher will attempt to dispatch the event itself.
283 *
284 * @param e the AWTEvent to be dispatched
285 * @return <code>true</code> if this method dispatched the event;
286 * <code>false</code> otherwise
287 */
288 public boolean dispatchEvent(AWTEvent e) {
289 if (focusLog.isLoggable(Level.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) focusLog.fine("" + e);
290 switch (e.getID()) {
291 case WindowEvent.WINDOW_GAINED_FOCUS: {
292 WindowEvent we = (WindowEvent)e;
293 Window oldFocusedWindow = getGlobalFocusedWindow();
294 Window newFocusedWindow = we.getWindow();
295 if (newFocusedWindow == oldFocusedWindow) {
296 break;
297 }
298
299 if (!(newFocusedWindow.isFocusableWindow()
300 && newFocusedWindow.isVisible()
301 && newFocusedWindow.isDisplayable()))
302 {
303 // we can not accept focus on such window, so reject it.
304 restoreFocus(we);
305 break;
306 }
307 // If there exists a current focused window, then notify it
308 // that it has lost focus.
309 if (oldFocusedWindow != null) {
|
269 }
270 }
271 return se.dispatched;
272 }
273
274 /**
275 * This method is called by the AWT event dispatcher requesting that the
276 * current KeyboardFocusManager dispatch the specified event on its behalf.
277 * DefaultKeyboardFocusManagers dispatch all FocusEvents, all WindowEvents
278 * related to focus, and all KeyEvents. These events are dispatched based
279 * on the KeyboardFocusManager's notion of the focus owner and the focused
280 * and active Windows, sometimes overriding the source of the specified
281 * AWTEvent. If this method returns <code>false</code>, then the AWT event
282 * dispatcher will attempt to dispatch the event itself.
283 *
284 * @param e the AWTEvent to be dispatched
285 * @return <code>true</code> if this method dispatched the event;
286 * <code>false</code> otherwise
287 */
288 public boolean dispatchEvent(AWTEvent e) {
289 if (focusLog.isLoggable(Level.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) {
290 focusLog.fine("" + e);
291 }
292 switch (e.getID()) {
293 case WindowEvent.WINDOW_GAINED_FOCUS: {
294 WindowEvent we = (WindowEvent)e;
295 Window oldFocusedWindow = getGlobalFocusedWindow();
296 Window newFocusedWindow = we.getWindow();
297 if (newFocusedWindow == oldFocusedWindow) {
298 break;
299 }
300
301 if (!(newFocusedWindow.isFocusableWindow()
302 && newFocusedWindow.isVisible()
303 && newFocusedWindow.isDisplayable()))
304 {
305 // we can not accept focus on such window, so reject it.
306 restoreFocus(we);
307 break;
308 }
309 // If there exists a current focused window, then notify it
310 // that it has lost focus.
311 if (oldFocusedWindow != null) {
|