Example usage for java.awt Container isFocusTraversalPolicyProvider

List of usage examples for java.awt Container isFocusTraversalPolicyProvider

Introduction

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

Prototype

public final boolean isFocusTraversalPolicyProvider() 

Source Link

Document

Returns whether this container provides focus traversal policy.

Usage

From source file:org.jdal.swing.form.FormFocusTransversalPolicy.java

private Component getComponent(int index) {
    Component c = components.get(index);
    Container cc = null;
    if (c instanceof Container) {
        cc = (Container) c;//from w  w  w.jav a 2 s .co  m
        if (cc.isFocusTraversalPolicyProvider() || cc.isFocusCycleRoot())
            c = cc.getFocusTraversalPolicy().getFirstComponent(cc);
        else if (cc instanceof JScrollPane) {
            if (((JScrollPane) cc).getViewport().getComponentCount() > 0)
                c = ((JScrollPane) cc).getViewport().getComponent(0);
        }
    }
    return c != null ? c : cc;
}

From source file:org.jdal.swing.form.FormFocusTransversalPolicy.java

/**
 * @param component//from ww w .ja v  a  2s  . c  o m
 * @return
 */
@SuppressWarnings("unused")
private FocusTraversalPolicy getFocusTraversalPolicyForComponent(Component component) {
    Container c = null;
    while ((c = component.getParent()) != null) {
        if (c.isFocusTraversalPolicyProvider())
            return c.getFocusTraversalPolicy();
        component = c;
    }

    return null;
}

From source file:org.jdal.swing.form.FormFocusTransversalPolicy.java

Container getTopmostProvider(Container focusCycleRoot, Component aComponent) {
    Container aCont = aComponent.getParent();
    Container ftp = null;/*from w  w  w .j a v a  2  s. c om*/
    while (aCont != focusCycleRoot && aCont != null) {
        if (aCont.isFocusTraversalPolicyProvider()) {
            ftp = aCont;
        }
        aCont = aCont.getParent();
    }
    if (aCont == null) {
        return null;
    }
    return ftp;
}