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


Java Component.isFocusable方法代码示例

本文整理汇总了Java中java.awt.Component.isFocusable方法的典型用法代码示例。如果您正苦于以下问题:Java Component.isFocusable方法的具体用法?Java Component.isFocusable怎么用?Java Component.isFocusable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Component的用法示例。


在下文中一共展示了Component.isFocusable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFocusTraversableComponent

import java.awt.Component; //导入方法依赖的package包/类
/** Find a focus-traverable component.
* @param c the component to look in
* @return the same component if traversable, else a child component if present, else <code>null</code>
* @see Component#isFocusTraversable
*/
public static Component getFocusTraversableComponent(Component c) {
    if (c.isFocusable()) {
        return c;
    }

    if (!(c instanceof Container)) {
        return null;
    }

    int i;
    int k = ((Container) c).getComponentCount();

    for (i = 0; i < k; i++) {
        Component v = ((Container) c).getComponent(i);

        if (v != null) {
            return v;
        }
    }

    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:Utilities.java

示例2: 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

示例3: processComponentKeyEvent

import java.awt.Component; //导入方法依赖的package包/类
@Override
protected void processComponentKeyEvent(KeyEvent e) {
    Component editorComponent = getEditorComponent();
    if (editorComponent != null && editorComponent.isFocusable()) {
        // The event should go to the editor component
        editorComponent.requestFocusInWindow();
        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
    } else {
        super.processComponentKeyEvent(e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:OutlineView.java

示例4: generateFocusEvents

import java.awt.Component; //导入方法依赖的package包/类
private static void generateFocusEvents(Component c) {
    if (c == focusComponent || !c.isFocusable()) {
        return;
    }
    if (focusComponent != null) {
        dispatchEvent(new FocusEvent(focusComponent, FocusEvent.FOCUS_LOST, false, c));
    }
    dispatchEvent(new FocusEvent(c, FocusEvent.FOCUS_GAINED, false, focusComponent));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:EventQueueWait.java

示例5: focusable

import java.awt.Component; //导入方法依赖的package包/类
private static boolean focusable(Component c) {
    if (c instanceof JLabel || c instanceof Box.Filler) return false;
    return c.isVisible() && c.isEnabled() && c.isFocusable();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ProfilerPopup.java

示例6: focusable

import java.awt.Component; //导入方法依赖的package包/类
protected boolean focusable(Component c) {
    return c.isVisible() && c.isEnabled() && c.isFocusable();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:ProfilerToolbar.java


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