Sun Java Solaris Communities My SDN Account Join SDN
 
Code sample

Code Samples from the Java Developers Almanac 2000

 

Code Samples Index

These code examples and other materials are subject to Sun Microsystems, Inc. Legal Terms

The Quintessential Accessible Object

You should try to subclass from JComponent or one of its descendents since that will automatically make your object accessible. If that is not possible, your object should implement Accessible.

 
 import javax.accessibility.*;
     
   public class BasicAccessible implements Accessible {
     public AccessibleContext getAccessibleContext() {
       return new AccessibleContext() {
         // Implement all the abstract methods in this 
         // abstract class.
       };
     }
   }
 
 

Examplets provided by permission of the publisher, Addision-Wesley, and Author Patrick Chan.
Order this book from Amazon