Example usage for javax.accessibility AccessibleContext getAccessibleChildrenCount

List of usage examples for javax.accessibility AccessibleContext getAccessibleChildrenCount

Introduction

In this page you can find the example usage for javax.accessibility AccessibleContext getAccessibleChildrenCount.

Prototype

public abstract int getAccessibleChildrenCount();

Source Link

Document

Returns the number of accessible children of the object.

Usage

From source file:MainClass.java

void dumpComponentInfo(AccessibleContext ac) {
    AccessibleComponent ax = ac.getAccessibleComponent();

    if (ax != null) {
        String s = ac.getAccessibleName();

        if (s != null && s.equals("OK")) {
            System.out.println("Background color: " + ax.getBackground());
            System.out.println("Cursor: " + ax.getCursor());
            Cursor c = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
            ax.setCursor(c);/*from   w  ww  .j  a  va  2 s .co  m*/
            System.out.println("Foreground color: " + ax.getForeground());
            System.out.println("Location: " + ax.getLocationOnScreen());
        }
    }

    int nChildren = ac.getAccessibleChildrenCount();

    for (int i = 0; i < nChildren; i++)
        dumpComponentInfo(ac.getAccessibleChild(i).getAccessibleContext());
}

From source file:MainClass.java

void dumpHypertextInfo(AccessibleContext ac) {
    AccessibleText at = ac.getAccessibleText();

    AccessibleHypertext ah = null;
    if (at instanceof AccessibleHypertext)
        ah = (AccessibleHypertext) at;

    if (ah != null) {
        int nLinks = ah.getLinkCount();

        for (int i = 0; i < nLinks; i++) {
            AccessibleHyperlink ahl = ah.getLink(i);

            int nActions = ahl.getAccessibleActionCount();

            for (int j = 0; j < nActions; j++) {
                String s = ahl.getAccessibleActionDescription(j);
                System.out.println("Action = " + s);
            }// w  w  w. j av  a2s.c o m
        }
        return;
    }

    int nChildren = ac.getAccessibleChildrenCount();

    for (int i = 0; i < nChildren; i++)
        dumpHypertextInfo(ac.getAccessibleChild(i).getAccessibleContext());
}

From source file:org.eclipse.jubula.rc.swing.tester.adapter.JComboBoxAdapter.java

/**
 * Tries to find the popup menu from the combobox
 * @param component the combobox/*from   w ww .j a va  2 s  .c om*/
 * @return the popup of the combobox
 * @throws StepExecutionException if the popup could not be found
 */
private JPopupMenu getPopupMenu(JComboBox component) throws StepExecutionException {

    AccessibleContext ac = component.getAccessibleContext();
    for (int i = 0; i < ac.getAccessibleChildrenCount(); i++) {
        Accessible a = ac.getAccessibleChild(i);
        if (a instanceof JPopupMenu) {
            return (JPopupMenu) a;
        }
    }
    throw new StepExecutionException("cannot find dropdown list", //$NON-NLS-1$
            EventFactory.createActionError(TestErrorEvent.DROPDOWN_LIST_NOT_FOUND));
}