KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > accessibility > AccessibleKeyBinding


1 /*
2  * @(#)AccessibleKeyBinding.java 1.4 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.accessibility;
9
10 /**
11  * The AccessibleKeyBinding interface should be supported by any object
12  * that has a keyboard bindings such as a keyboard mnemonic and/or keyboard
13  * shortcut which can be used to select the object. This interface provides
14  * the standard mechanism for an assistive technology to determine the
15  * key bindings which exist for this object.
16  * Any object that has such key bindings should support this
17  * interface. Applications can determine if an object supports the
18  * AccessibleKeyBinding interface by first obtaining its AccessibleContext
19  * (see @link Accessible} and then calling the
20  * {@link AccessibleContext#getAccessibleKeyBinding} method. If the return
21  * value is not null, the object supports this interface.
22  *
23  * @see Accessible
24  * @see Accessible#getAccessibleContext
25  * @see AccessibleContext
26  * @see AccessibleContext#getAccessibleKeyBinding
27  *
28  * @version 1.4 12/19/03
29  * @author Lynn Monsanto
30  */

31 public interface AccessibleKeyBinding {
32
33     /**
34      * Returns the number of key bindings for this object
35      *
36      * @return the zero-based number of key bindings for this object
37      */

38     public int getAccessibleKeyBindingCount();
39
40     /**
41      * Returns a key binding for this object. The value returned is an
42      * java.lang.Object which must be cast to appropriate type depending
43      * on the underlying implementation of the key. For example, if the
44      * Object returned is a javax.swing.KeyStroke, the user of this
45      * method should do the following:
46      * <nf><code>
47      * Component c = <get the component that has the key bindings>
48      * AccessibleContext ac = c.getAccessibleContext();
49      * AccessibleKeyBinding akb = ac.getAccessibleKeyBinding();
50      * for (int i = 0; i < akb.getAccessibleKeyBindingCount(); i++) {
51      * Object o = akb.getAccessibleKeyBinding(i);
52      * if (o instanceof javax.swing.KeyStroke) {
53      * javax.swing.KeyStroke keyStroke = (javax.swing.KeyStroke)o;
54      * <do something with the key binding>
55      * }
56      * }
57      * </code></nf>
58      *
59      * @param i zero-based index of the key bindings
60      * @return a javax.lang.Object which specifies the key binding
61      * @see #getAccessibleKeyBindingCount
62      */

63     public java.lang.Object JavaDoc getAccessibleKeyBinding(int i);
64 }
65
Popular Tags