Chapter 25. Programming with Accessibility


Accessibility is a Java feature that allows you to extend your programs by interfacing an application's components with assistive technologies that have special permission to use them. Assistive technologies are, in the narrowest sense, specialized tools that people can use to assist in interacting with your application; examples include voice-recognition and audio output. In a broader sense, however, assistive technologies can be robust application suites that can assist just about anybody with anything.

It helps to think of accessibility as a two-sided conversation. This conversation takes place between an assistive technology and the "accessibility-friendly" components of applications. Assistive technologies are quite powerful: Java grants them access to all the components in the virtual machine that they can interface with, as well as the ability to interface with the windowing event queue. The latter gives an assistive technology the ability to monitor graphical events. The former means that an assistive technology can directly interact with the GUI widgets of one or more applications quickly and easily, without disrupting the application beneath it.

In order for components to interface with assistive technologies, they must implement special "accessible" interfaces. (The Swing components already implement these interfaces.) There are six unique interfaces for exporting accessible functionality: one each for actions, component properties, selections, text properties, hyperlinks, and bounded-range values. For each type of accessibility exported, one or more objects inside that component can be directly manipulated through that interface. For example, the JTextField Swing component supports text accessibility. Therefore, a voice-recognition program can insert letters in the field by obtaining the text-accessible interface and copying out the words that the user has spoken.

As there are two sides to accessibility, there are also two programming packages to deal with: the Accessibility API and the Accessibility Utility API. The first API defines the interfaces and classes that the programmer must implement on the application side in order for the components to be accessibility-friendly. The Accessibility Utility API, on the other hand, is a package of utilities that assistive technologies can incorporate into their own classes in order to "hook" into the JVM and interface with the application. Sun bundles the former with the Swing libraries. The latter is distributed independently, typically by the assistive technology vendor, similar to peripheral vendors providing drivers for their equipment.

Another way of creating an assistive interface in JDK 1.2 or higher is to take advantage of the MultiLookandFeel with one or more Swing components. For example, in addition to a graphical L&F, you might also redirect certain elements of the UI delegates to an audio output or a braille display. While a new L&F can technically be considered an assistive technology, this approach is better explained in Chapter 26.

IBM has developed a great site on developing accessible applications in Java. You can check out this resource at http://www-3.ibm.com/able/accessjava.html.



Java Swing
Graphic Java 2: Mastering the Jfc, By Geary, 3Rd Edition, Volume 2: Swing
ISBN: 0130796670
EAN: 2147483647
Year: 2001
Pages: 289
Authors: David Geary

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net