javax.accessibility


1. Accessibility API with Swing

JButton button = new JButton("Click me");
button.getAccessibleContext().setAccessibleName("My button");
button.getAccessibleContext().setAccessibleDescription("This button does something");

2. Using an AccessibleContext

AccessibleContext context = button.getAccessibleContext();
String name = context.getAccessibleName();
String description = context.getAccessibleDescription();

3. Getting the Role of an Accessible

AccessibleRole role = context.getAccessibleRole();
if (role == AccessibleRole.BUTTON) {
    // Do something with a button
}

4. Getting the State of an Accessible

AccessibleStateSet stateSet = context.getAccessibleStateSet();
if (stateSet.contains(AccessibleState.FOCUSED)) {
    // The button is focused
}

5. Getting the Children of an Accessible

6. Getting the Parent of an Accessible

7. Getting the Index of an Accessible

8. Getting the AccessibleText of an Accessible

9. Getting the AccessibleAction of an Accessible

10. Getting the AccessibleValue of an Accessible

11. Getting the AccessibleSelection of an Accessible

12. Getting the AccessibleTable of an Accessible

13. Getting the AccessibleExtendedTable of an Accessible

14. Getting the AccessibleHyperlink of an Accessible

15. Getting the AccessibleImage of an Accessible

16. Getting the AccessibleIcon of an Accessible

17. Getting the AccessibleDocument of an Accessible

18. Getting the AccessibleAnnotation of an Accessible

19. Getting the AccessibleTableCaption of an Accessible

20. Getting the AccessibleTableColumn of an Accessible

21. Getting the AccessibleTableRow of an Accessible

22. Getting the AccessibleTableCell of an Accessible

23. Getting the AccessibleChart of an Accessible

24. Getting the AccessibleDiagram of an Accessible

25. Getting the AccessibleComponent of an Accessible

26. Getting the AccessibleTextComponent of an Accessible

27. Getting the AccessibleTextComponent of an Accessible

28. Getting the AccessibleValueComponent of an Accessible