当前位置: 首页>>代码示例>>Java>>正文


Java Component.isDisplayable方法代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:LegacyGlueFocusTraversalPolicy.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:KeyboardFocusManagerPeerImpl.java


注:本文中的java.awt.Component.isDisplayable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。