音声ブラウザご使用の方向け: SKIP NAVI GOTO NAVI

Web Posted on: February 24, 1998


WORKING TOWARDS ACCESSIBLE JAVA APPLICATIONS

Wendy Chisholm, M.S.
chisholm@trace.wisc.edu
Neal Ewers
ewers@trace.wisc.edu
Mark Novak BSEE
PE novak@trace.wisc.edu
Trace R&D Center
1500 Highland Avenue Madison
WI 53705
(608) 262-6966

Abstract

This paper provides an overview of current cooperative efforts by the Trace Center to develop accessible applications with Java. Much of the challenge in applying Java is understanding and applying the object oriented technology. If applied properly, "object" technology can make it easier for programmers and programming tools to provide the additional information often required by assistive technologies.

This paper provides a brief review of terminology and object technology followed by an examination of a few Java applications for accessibility and usability issues. All examples are created with the 1.1.5 release of the JDK and Swing 0.7.

Explanation of terminology

Accessibility API: This package "defines a contract" between user interface objects and screen access products. Since Swing components support the accessibility interfaces it is "fairly" simple to write programs that are usable by people with disabilities. It is also easy to make custom components, those that are developed using the AWT or from scratch, accessible using the Accessibility package.

AWT (Abstract Windowing Toolkit): This is the initial set of classes released as the Java Language. Applications developed with this package rely on the operating system to draw components. This means that if the operating system that the Java application is running on does not provide the appropriate information the application may not be accessible. It also means that the application will look different for each operating system it is run on.

Swing: This package of classes, still under development, is based on Netscape's Internet Foundation Classes (IFC). Contrasted to the AWT, Swing provides a set of widgets and a framework that allows developers to specify how their GUI will be presented ACROSS platforms. We will show you an example of the difference in information provided by the Swing classes versus the AWT classes.

Object Oriented Technology

Object Oriented Technology (OOT) is not a new concept. In fact, OOT has been around for over 20 years. OOT is talked about so much today because of the overwhelming popularity of the internet and the world wide web (WWW). Much of what the internet and the WWW represent, distributed computing or "client-server" architecture, lends itself directly to the use of OOT.

So what is OOT? Basically, in OOT everything is an "object". An "object" is defined as a self-contained unit that combines both "data" and a means to operate on that stored data. Object operators are typically referred to as "methods." OOT actually "mirrors" the real world and behavior in the real world. This means that everything we deal with on a day to day basis is or can be thought of as an object. The apple in our lunch, the TV in our homes, our car, etc., are all objects. Note, that some objects are more complex than others or consist of many other objects.

To better understand the concept of "objects," think of a can of pop. The pop can "encapsulates" or contains the soda (think of the soda as the can's data). To access the soda (object's data), we must use an operator, or object method. The pop can has one "public" method to access the soda (data), which is the pop can pop-top (method). By opening the pop-top, we are able to access the soda (data). This pop can analogy closely resembles how software objects created using OOT behave. An object has stored data (information) that is only available to other objects by properly using the methods supplied by the object. Realize that there are many different types of objects, data and methods that we have not discussed.

What are some of the advantages of OOT? Well, according to the literature, OOT applications:

  • Are easier to read
  • More closely resemble how humans think and solve problems
  • Are more efficient to reuse pieces of code
  • Are more robust
  • Have faster time to market
  • Are more modularized

In the accessibility/usability field, we can make use of OOT in two distinct areas.

  1. The creation of accessible information
  2. The communication of accessible information

OOT supports information (data) storage and information retrieval (methods) on an object basis. Before OOT, someone (usually the programmer) had to create structures that acted like data and procedures to access that data. Objects provide this behavior by default. Since objects contain data and methods to access that data, objects can communicate with each other. This communication can occur between objects on the same computer within the same application, or on different computers in different applications across the internet, or on a computer talking to a personal pager, or on a cellular phone talking to a web server, etc. The opportunities appear to be endless.

However, there is a price. Before two objects can communicate, they must be able to talk the "same" language and understand how each other store and access their data. Finally, many of the underlying transport mechanisms and development environments are changing so fast it has been and will continue to be difficult to keep up with the changes in OOT.

Simple Java Applications Demonstrating Accessibility and Usability Issues

By the conference date (March 17, 1998), source code for the following demonstrations (and perhaps others) should be available in a public directory for anyone to download and experiment with at the Trace Center web site:

http://trace.wisc.edu/world/java/java.htm

We've included some snippets of the source code from each of the demonstrations below to help present the concepts being discussed.

The first demonstration highlights some of the basic differences between the AWT and Swing components. To do this, we?ve created a simple Java application that is nothing more than a button and some menu items. The Java application creates two top level windows, one created using AWT components, and the other created using Swing components. To understand some of the basic differences, we?ll us a modified version of Explorer to examine the application. Explorer is one of the three accessibility utilities that SUN shipped with the early releases of Swing and the Java Accessibility Interface.

Some of the issues we will be discussing while viewing this demonstration are:

  1. Similar methods are used to create AWT and Swing components such as buttons and menus.
  2. Vastly different information is available from AWT versus Swing components.

// creating a button using AWT:

Button b = new Button("This is an AWT Button");

// creating a button using Swing:

JButton a = new JButton("This is a JButton or Swing"); a.setKeyAccelerator('J');

a.setFont(new Font("SansSerif", Font.PLAIN, 18));

// creating a menu using AWT:

Menu d = new Menu("AWT Menu");

// creating a menu using Swing:

JMenuItem item1 = new JMenuItem("Input Dialog Example");

The second demonstration shows simple additions to an application that enhances the accessibility. We use Swing components like JLabels and add keyboard navigation to components like Jmenus/JMenuItems. To do this we?ve created another simple Java application that is nothing more than a group of radio buttons and some menu items.

Some of the issues we will be discussing while viewing this demonstration are:

  1. How to attach a JLabel to a button group.
  2. How easy it is to work with Swing components like buttons and menus and how to provide keyboard navigation.

JPanel holdButtons = new JPanel();

JLabel label = new JLabel ("Possible Radio Button Label ?); label.setLabelFor(holdButtons);

holdButtons.add(label);

// Creating the radio button group first

ButtonGroup group = new ButtonGroup();

jlfButton = new JRadioButton("JLF");

jlfButton.setFont(new Font("SansSerif", Font.PLAIN, 18)); jlfButton.setKeyAccelerator('j');

group.add(jlfButton);

holdButtons.add(jlfButton);

// creating JMenu/JMenuItems, and adding key and keyboard

// shortcut accelerators.

JMenu menuA = new JMenu("File ");

menuA.setKeyAccelerator('F');

MenuShortcut myShortcut = new MenuShortcut(KeyEvent.VK_K); JMenuItem firstItem = new JMenuItem("New ", myShortcut);

Java Applications Demonstrating MVC and Pluggable Look and Feel

MVC ("Model-View-Controller") is a programming paradigm used to create flexible user interfaces. It is a boon for programming for accessibility because it causes the developer to separate the code that presents the data and interacts with the user from the data and application logic.

Thinking back to the pop and pop can analogy, the can represents how we get at and display the data (the pop). Let us say that the only data value the pop represents is "how many ounces" and we will set that to "12." Therefore, if we pour the pop into a glass, and assume that the glass is larger than 12 ounces, the data has not changed. We still have 12 ounces of pop. We have two methods to change the value of the pop. We can reduce the number of ounces by drinking from a straw or by tilting the glass.

In the MVC paradigm, the pop represents the "model." The can, and the glass represent the "views" and the straw and the tilting are "controllers." In a computer user interface, the model is the application logic (state), the controller supplies the user input to the model (feel) and the view displays the information from the model (look).

Our next demonstration will show how a model can have several views and controllers. Other possibilities include command-line and graphical controllers and views.

References

Baldwin, Richard G. (1997) Implementing the Model-View-Controller paradigm using Observer and Observable.? Available:? http://www.geocities.com/Athens/7077/Java200.htm

Java Report (1997-1998) Various Articles. Available: http://www.sigs.com/jro

Solutions Consulting. (1997) SerialPort - The Java Class for Serial Ports (software) Available: http://www.scsystems.com/serPort.html

Sun Microsystems (1998) Java Accessibility API (software) Available:? http://java.sun.com/products/jfc/accessibility/doc/index.html

Trace Research and Development. (1997)