本文整理汇总了Java中java.awt.event.FocusEvent.Cause方法的典型用法代码示例。如果您正苦于以下问题:Java FocusEvent.Cause方法的具体用法?Java FocusEvent.Cause怎么用?Java FocusEvent.Cause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.FocusEvent
的用法示例。
在下文中一共展示了FocusEvent.Cause方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLightweightRequest
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
boolean addLightweightRequest(Component descendant,
boolean temporary, FocusEvent.Cause cause) {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
log.fine("Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed");
}
if (descendant == null) {
log.fine("Assertion (descendant != null) failed");
}
}
Component lastDescendant = ((lightweightRequests.size() > 0)
? lightweightRequests.getLast().component
: null);
if (descendant != lastDescendant) {
// Not a duplicate request
lightweightRequests.add
(new LightweightFocusRequest(descendant, temporary, cause));
return true;
} else {
return false;
}
}
示例2: requestWindowFocus
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public boolean requestWindowFocus(FocusEvent.Cause cause) {
if (!focusAllowedFor()) {
return false;
}
if (getPlatformWindow().rejectFocusRequest(cause)) {
return false;
}
Window opposite = LWKeyboardFocusManagerPeer.getInstance().
getCurrentFocusedWindow();
changeFocusedWindow(true, opposite);
return true;
}
示例3: shouldNativelyFocusHeavyweight
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public int shouldNativelyFocusHeavyweight(Component heavyweight,
Component descendant,
boolean temporary,
boolean focusedWindowChangeAllowed,
long time,
FocusEvent.Cause cause)
{
return KeyboardFocusManager.shouldNativelyFocusHeavyweight(
heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
}
示例4: HeavyweightFocusRequest
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
HeavyweightFocusRequest(Component heavyweight, Component descendant,
boolean temporary, FocusEvent.Cause cause) {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
if (heavyweight == null) {
log.fine("Assertion (heavyweight != null) failed");
}
}
this.heavyweight = heavyweight;
this.lightweightRequests = new LinkedList<LightweightFocusRequest>();
addLightweightRequest(descendant, temporary, cause);
}
示例5: deliverFocus
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public static boolean deliverFocus(Component lightweightChild,
Component target,
boolean temporary,
boolean focusedWindowChangeAllowed,
long time,
FocusEvent.Cause cause,
Component currentFocusOwner) // provided by the descendant peers
{
if (lightweightChild == null) {
lightweightChild = target;
}
Component currentOwner = currentFocusOwner;
if (currentOwner != null && !currentOwner.isDisplayable()) {
currentOwner = null;
}
if (currentOwner != null) {
FocusEvent fl = new FocusEvent(currentOwner, FocusEvent.FOCUS_LOST,
false, lightweightChild, cause);
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Posting focus event: " + fl);
}
SunToolkit.postEvent(SunToolkit.targetToAppContext(currentOwner), fl);
}
FocusEvent fg = new FocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED,
false, currentOwner, cause);
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Posting focus event: " + fg);
}
SunToolkit.postEvent(SunToolkit.targetToAppContext(lightweightChild), fg);
return true;
}
示例6: shouldNativelyFocusHeavyweight
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public static int shouldNativelyFocusHeavyweight(Component heavyweight,
Component descendant,
boolean temporary,
boolean focusedWindowChangeAllowed,
long time,
FocusEvent.Cause cause)
{
return KfmAccessor.instance.shouldNativelyFocusHeavyweight(
heavyweight, descendant, temporary, focusedWindowChangeAllowed,
time, cause);
}
示例7: deliverFocus
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public static boolean deliverFocus(Component lightweightChild,
Component target,
boolean temporary,
boolean focusedWindowChangeAllowed,
long time,
FocusEvent.Cause cause)
{
return KeyboardFocusManagerPeerImpl.deliverFocus(lightweightChild,
target,
temporary,
focusedWindowChangeAllowed,
time,
cause,
getInstance().getCurrentFocusOwner());
}
示例8: requestFocus
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public final boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
FocusEvent.Cause cause)
{
if (XKeyboardFocusManagerPeer.
processSynchronousLightweightTransfer(target, lightweightChild, temporary,
focusedWindowChangeAllowed, time))
{
return true;
}
int result = XKeyboardFocusManagerPeer.
shouldNativelyFocusHeavyweight(target, lightweightChild,
temporary, focusedWindowChangeAllowed,
time, cause);
switch (result) {
case XKeyboardFocusManagerPeer.SNFH_FAILURE:
return false;
case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
// Currently we just generate focus events like we deal with lightweight instead of calling
// XSetInputFocus on native window
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Proceeding with request to " +
lightweightChild + " in " + target);
}
/**
* The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight
* checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet
* been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record
* in requests list - and it breaks our requests sequence as first record on WGF should be the last
* focus owner which had focus before WLF. So, we should not add request record for such requests
* but store this component in mostRecent - and return true as before for compatibility.
*/
Window parentWindow = SunToolkit.getContainingWindow(target);
if (parentWindow == null) {
return rejectFocusRequestHelper("WARNING: Parent window is null");
}
XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer == null) {
return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
}
/*
* Passing null 'actualFocusedWindow' as we don't want to restore focus on it
* when a component inside a Frame is requesting focus.
* See 6314575 for details.
*/
boolean res = wpeer.requestWindowFocus(null);
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Requested window focus: " + res);
}
// If parent window can be made focused and has been made focused(synchronously)
// then we can proceed with children, otherwise we retreat.
if (!(res && parentWindow.isFocused())) {
return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
}
return XKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
target,
temporary,
focusedWindowChangeAllowed,
time, cause);
// Motif compatibility code
case XKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
// Either lightweight or excessive request - all events are generated.
return true;
}
return false;
}
示例9: rejectFocusRequest
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public boolean rejectFocusRequest(FocusEvent.Cause cause) {
// Cross-app activation requests are not allowed.
if (cause != FocusEvent.Cause.MOUSE_EVENT &&
!target.isParentWindowActive())
{
focusLogger.fine("the embedder is inactive, so the request is rejected");
return true;
}
return false;
}
示例10: LightweightFocusRequest
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
LightweightFocusRequest(Component component, boolean temporary, FocusEvent.Cause cause) {
this.component = component;
this.temporary = temporary;
this.cause = cause;
}
示例11: requestFocusFor
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public static void requestFocusFor(Component target, FocusEvent.Cause cause) {
AWTAccessor.getComponentAccessor().requestFocus(target, cause);
}
示例12: rejectFocusRequest
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public boolean rejectFocusRequest(FocusEvent.Cause cause) {
return false;
}
示例13: requestFocus
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
@Override
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
FocusEvent.Cause cause)
{
if (WKeyboardFocusManagerPeer.
processSynchronousLightweightTransfer((Component)target, lightweightChild, temporary,
focusedWindowChangeAllowed, time))
{
return true;
}
int result = WKeyboardFocusManagerPeer
.shouldNativelyFocusHeavyweight((Component)target, lightweightChild,
temporary, focusedWindowChangeAllowed,
time, cause);
switch (result) {
case WKeyboardFocusManagerPeer.SNFH_FAILURE:
return false;
case WKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Proceeding with request to " + lightweightChild + " in " + target);
}
Window parentWindow = SunToolkit.getContainingWindow((Component)target);
if (parentWindow == null) {
return rejectFocusRequestHelper("WARNING: Parent window is null");
}
final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(parentWindow);
if (wpeer == null) {
return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
}
boolean res = wpeer.requestWindowFocus(cause);
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Requested window focus: " + res);
}
// If parent window can be made focused and has been made focused(synchronously)
// then we can proceed with children, otherwise we retreat.
if (!(res && parentWindow.isFocused())) {
return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
}
return WKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
(Component)target,
temporary,
focusedWindowChangeAllowed,
time, cause);
case WKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
// Either lightweight or excessive request - all events are generated.
return true;
}
return false;
}
示例14: rejectFocusRequest
import java.awt.event.FocusEvent; //导入方法依赖的package包/类
public boolean rejectFocusRequest(FocusEvent.Cause cause);