Example usage for javax.accessibility AccessibleContext getAccessibleComponent

List of usage examples for javax.accessibility AccessibleContext getAccessibleComponent

Introduction

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

Prototype

public AccessibleComponent getAccessibleComponent() 

Source Link

Document

Gets the AccessibleComponent associated with this object that has a graphical representation.

Usage

From source file:Main.java

private static void setForeground0(AccessibleContext ac, Color fg) {
    ac.getAccessibleComponent().setForeground(fg);
    for (int i = 0; i < ac.getAccessibleChildrenCount(); i++) {
        setForeground0(ac.getAccessibleChild(i).getAccessibleContext(), fg);
    }/*from ww w .j ava2 s . c  o m*/
}

From source file:Main.java

private static void setBackground0(AccessibleContext ac, Color bg) {
    ac.getAccessibleComponent().setBackground(bg);
    int n = ac.getAccessibleChildrenCount();
    for (int i = 0; i < n; i++) {
        setBackground0(ac.getAccessibleChild(i).getAccessibleContext(), bg);
    }//from   w w w  .j a  va  2  s .  co  m
}

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);/*ww  w.  j  a va  2  s  . c  om*/
            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());
}