本文整理汇总了Java中java.awt.event.WindowEvent.WINDOW_LOST_FOCUS属性的典型用法代码示例。如果您正苦于以下问题:Java WindowEvent.WINDOW_LOST_FOCUS属性的具体用法?Java WindowEvent.WINDOW_LOST_FOCUS怎么用?Java WindowEvent.WINDOW_LOST_FOCUS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.WindowEvent
的用法示例。
在下文中一共展示了WindowEvent.WINDOW_LOST_FOCUS属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postEvent
public static void postEvent(AppContext appContext, AWTEvent event) {
if (event == null) {
throw new NullPointerException();
}
AWTAccessor.SequencedEventAccessor sea = AWTAccessor.getSequencedEventAccessor();
if (sea != null && sea.isSequencedEvent(event)) {
AWTEvent nested = sea.getNested(event);
if (nested.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
nested instanceof TimedWindowEvent)
{
TimedWindowEvent twe = (TimedWindowEvent)nested;
((SunToolkit)Toolkit.getDefaultToolkit()).
setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
}
}
// All events posted via this method are system-generated.
// Placing the following call here reduces considerably the
// number of places throughout the toolkit that would
// otherwise have to be modified to precisely identify
// system-generated events.
setSystemGenerated(event);
AppContext eventContext = targetToAppContext(event.getSource());
if (eventContext != null && !eventContext.equals(appContext)) {
throw new RuntimeException("Event posted on wrong app context : " + event);
}
PostEventQueue postEventQueue =
(PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
if (postEventQueue != null) {
postEventQueue.postEvent(event);
}
}
示例2: handleWindowFocusOut
public void handleWindowFocusOut(Window oppositeWindow, long serial) {
WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
/* wrap in Sequenced, then post*/
postEvent(wrapInSequenced((AWTEvent) we));
}
示例3: handleEvent
public void handleEvent(java.awt.AWTEvent e) {
if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled()) {
if (e instanceof MouseEvent) {
if (e instanceof MouseWheelEvent) {
handleJavaMouseWheelEvent((MouseWheelEvent) e);
}
else
handleJavaMouseEvent((MouseEvent) e);
}
else if (e instanceof KeyEvent) {
handleF10JavaKeyEvent((KeyEvent)e);
handleJavaKeyEvent((KeyEvent)e);
}
}
else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
// even if target is disabled.
handleF10JavaKeyEvent((KeyEvent)e);
}
else if (e instanceof InputMethodEvent) {
handleJavaInputMethodEvent((InputMethodEvent) e);
}
int id = e.getID();
switch(id) {
case PaintEvent.PAINT:
// Got native painting
paintPending = false;
// Fallthrough to next statement
case PaintEvent.UPDATE:
// Skip all painting while layouting and all UPDATEs
// while waiting for native paint
if (!isLayouting && !paintPending) {
paintArea.paint(target,false);
}
return;
case FocusEvent.FOCUS_LOST:
case FocusEvent.FOCUS_GAINED:
handleJavaFocusEvent(e);
break;
case WindowEvent.WINDOW_LOST_FOCUS:
case WindowEvent.WINDOW_GAINED_FOCUS:
handleJavaWindowFocusEvent(e);
break;
default:
break;
}
}
示例4: handleWindowFocusOutSync
public void handleWindowFocusOutSync(Window oppositeWindow, long serial) {
WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow);
XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null);
sendEvent(we);
}
示例5: handleEvent
@SuppressWarnings("fallthrough")
public void handleEvent(java.awt.AWTEvent e) {
if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() && target.isEnabled()) {
if (e instanceof MouseEvent) {
if (e instanceof MouseWheelEvent) {
handleJavaMouseWheelEvent((MouseWheelEvent) e);
}
else
handleJavaMouseEvent((MouseEvent) e);
}
else if (e instanceof KeyEvent) {
handleF10JavaKeyEvent((KeyEvent)e);
handleJavaKeyEvent((KeyEvent)e);
}
}
else if (e instanceof KeyEvent && !((InputEvent)e).isConsumed()) {
// even if target is disabled.
handleF10JavaKeyEvent((KeyEvent)e);
}
else if (e instanceof InputMethodEvent) {
handleJavaInputMethodEvent((InputMethodEvent) e);
}
int id = e.getID();
switch(id) {
case PaintEvent.PAINT:
// Got native painting
paintPending = false;
// Fallthrough to next statement
case PaintEvent.UPDATE:
// Skip all painting while layouting and all UPDATEs
// while waiting for native paint
if (!isLayouting && !paintPending) {
paintArea.paint(target,false);
}
return;
case FocusEvent.FOCUS_LOST:
case FocusEvent.FOCUS_GAINED:
handleJavaFocusEvent(e);
break;
case WindowEvent.WINDOW_LOST_FOCUS:
case WindowEvent.WINDOW_GAINED_FOCUS:
handleJavaWindowFocusEvent(e);
break;
default:
break;
}
}