Using Other Swing Features |
You might be wondering what exactly assistive technologies are, and why you should care. Primarily, assistive technologies exist to enable people with permanent or temporary disabilities to use the computer. For example, if you get carpal tunnel syndrome, you can use assistive technologies to accomplish your work without using your hands.Assistive technologies -- voice interfaces, screen readers, alternate input devices, and so on -- are useful not only for people with disabilities, but also for people using computers in non-office environments. For example, if you're stuck in a traffic jam, you might use assistive technologies to check your e-mail, using only voice input and output. The accessibility information can be used for other tools, as well, such as automated GUI testers.
[PENDING: Copy relevant accessibility information from A Tour Through a Swing Application.] Assistive technologies also automatically grab the tool tip text (if any) associated with a component and can use it to describe the component to the user.
Here are a few things you can do to make your program work as well as possible with assistive technologies:
- Use tool tips, wherever they make sense.
- Specify keyboard mnemonics wherever possible. You should be able to use your program with only the keyboard. Try hiding your mouse!
- Whenever you have a
JLabel
that displays a mnemonic for another component (such as a text field), use thesetLabelFor
method so that assistive technologies can find the component that the label is associated with.- Use the
setDescription
method to provide a text description for allImageIcon
s in your program.- If you don't provide a tool tip for a component, use the
setAccessibleDescription
method to provide a description that assistive technologies can give the user.- If a component doesn't display a short string (which serves as its default name), specify a name with the
setAccessibleName
method. You might want to do this for image-only buttons, panels that provide logical groupings, text areas, and so on.- If a bunch of components form a logical group, try to put them into one Swing container. For example, use a
JPanel
to contain all the radio buttons in a radio button group.
Using Other Swing Features |