本文整理汇总了Java中java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS属性的典型用法代码示例。如果您正苦于以下问题:Java WindowEvent.WINDOW_GAINED_FOCUS属性的具体用法?Java WindowEvent.WINDOW_GAINED_FOCUS怎么用?Java WindowEvent.WINDOW_GAINED_FOCUS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.WindowEvent
的用法示例。
在下文中一共展示了WindowEvent.WINDOW_GAINED_FOCUS属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: trackEvent
private static boolean trackEvent(int eventID, Component comp, Runnable action, int time, boolean printEvent) {
EventListener listener = null;
switch (eventID) {
case WindowEvent.WINDOW_GAINED_FOCUS:
listener = wgfListener;
break;
case FocusEvent.FOCUS_GAINED:
listener = fgListener;
break;
case ActionEvent.ACTION_PERFORMED:
listener = apListener;
break;
}
listener.listen(comp, printEvent);
action.run();
return Util.waitForCondition(listener.getNotifier(), time);
}
示例2: handleWmTakeFocus
private void handleWmTakeFocus(XClientMessageEvent cl) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("WM_TAKE_FOCUS on {0}", this);
}
if (XWM.getWMID() == XWM.UNITY_COMPIZ_WM) {
// JDK-8159460
Window focusedWindow = XKeyboardFocusManagerPeer.getInstance()
.getCurrentFocusedWindow();
Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
if (activeWindow != target) {
requestWindowFocus(cl.get_data(1), true);
} else {
WindowEvent we = new WindowEvent(focusedWindow,
WindowEvent.WINDOW_GAINED_FOCUS);
sendEvent(we);
}
} else {
requestWindowFocus(cl.get_data(1), true);
}
}
示例3: handleWindowFocusIn_Dispatch
public void handleWindowFocusIn_Dispatch() {
if (EventQueue.isDispatchThread()) {
XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target);
WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
SunToolkit.setSystemGenerated(we);
target.dispatchEvent(we);
}
}
示例4: 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;
}
}
示例5: handleWindowFocusInSync
public void handleWindowFocusInSync(long serial) {
WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target);
sendEvent(we);
}
示例6: handleWindowFocusIn
public void handleWindowFocusIn(long serial) {
WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
/* wrap in Sequenced, then post*/
XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target);
postEvent(wrapInSequenced((AWTEvent) we));
}
示例7: 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;
}
}