本文整理汇总了Java中java.awt.Component.isDisplayable方法的典型用法代码示例。如果您正苦于以下问题:Java Component.isDisplayable方法的具体用法?Java Component.isDisplayable怎么用?Java Component.isDisplayable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.isDisplayable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import java.awt.Component; //导入方法依赖的package包/类
private boolean accept(Component aComponent) {
if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
aComponent.isFocusable() && aComponent.isEnabled())) {
return false;
}
// Verify that the Component is recursively enabled. Disabling a
// heavyweight Container disables its children, whereas disabling
// a lightweight Container does not.
if (!(aComponent instanceof Window)) {
for (Container enableTest = aComponent.getParent();
enableTest != null;
enableTest = enableTest.getParent())
{
if (!(enableTest.isEnabled() || enableTest.isLightweight())) {
return false;
}
if (enableTest instanceof Window) {
break;
}
}
}
return true;
}
示例2: deliverFocus
import java.awt.Component; //导入方法依赖的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;
}