Example usage for java.awt Container isFocusable

List of usage examples for java.awt Container isFocusable

Introduction

In this page you can find the example usage for java.awt Container isFocusable.

Prototype

public boolean isFocusable() 

Source Link

Document

Returns whether this Component can be focused.

Usage

From source file:com.haulmont.cuba.desktop.gui.components.DesktopWindow.java

protected java.awt.Component getComponentToFocus(java.awt.Container component) {
    if (component.isFocusable() && component.isEnabled()
            && DesktopComponentsHelper.isRecursivelyVisible(component)) {
        if (component instanceof JComboBox || component instanceof JCheckBox || component instanceof JTable
                || component instanceof JTree) {
            return component;
        } else if (component instanceof JTextComponent && ((JTextComponent) component).isEditable()) {
            return component;
        }//  www.j a  v a2s  . com
    }
    for (java.awt.Component child : component.getComponents()) {
        if (child instanceof JTabbedPane) {
            // #PL-3176
            // we don't know about selected tab after request
            // may be focused component lays on not selected tab
            continue;
        }
        if (child instanceof java.awt.Container) {
            java.awt.Component result = getComponentToFocus((java.awt.Container) child);
            if (result != null) {
                return result;
            }
        } else {
            return child;
        }
    }
    return null;
}