本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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));
}
示例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();
}
示例6: focusable
import java.awt.Component; //导入方法依赖的package包/类
protected boolean focusable(Component c) {
return c.isVisible() && c.isEnabled() && c.isFocusable();
}