Provide a visual focus indicator that moves among interactive objects as the input focus changes. This focus indicator must be programmatically exposed to assistive technology.
This page provides specific examples to implement the Software techniques for providing visual focus indicator using Java Swing. For an explanation of this requirement, see Rationale for visual focus indicator for objects in the Software checklist.
The following techniques are the minimum required to meet Checkpoint 2.1 from the IBM Software Accessibility Checklist:
- Software must provide support for a visual focus indicator that responds to user input.
- Software must programmatically expose the focus information to assistive technology.
Examples for Java developers
The standard method to request the focus in the JFC is to have a particular component execute the
requestFocusmethod. In most cases, this is done automatically for you in JFC by providing keyboard access. See section 2.1 Making your Application Keyboard Accessible in the IBM Guidelines for Writing Accessible Applications Using 100% Pure Java.
JFC might not automatically request the focus when your Java application becomes the active window. This occurs when the user is running another application and clicks on your Java application with the mouse, or presses Alt+Tab to switch to your Java application. When this happens, your application becomes "active", but an object within the application may not necessarily receive the focus. You must create a "default focus" of your own choosing, using the JFC
Test the software to ensure it complies with accessibility requirements.
Required test software
Install the following software to test this checkpoint.
There are no unique steps for testing visual focus for Java Swing. Follow the required test techniques in Software checkpoint 2.1.
©2013 IBM Corporation
Last updated January 1, 2013.