1. /*
  2. * @(#)AccessibleKeyBinding.java 1.3 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.accessibility;
  8. /**
  9. * The AccessibleKeyBinding interface should be supported by any object
  10. * that has a keyboard bindings such as a keyboard mnemonic and/or keyboard
  11. * shortcut which can be used to select the object. This interface provides
  12. * the standard mechanism for an assistive technology to determine the
  13. * key bindings which exist for this object.
  14. * Any object that has such key bindings should support this
  15. * interface. Applications can determine if an object supports the
  16. * AccessibleKeyBinding interface by first obtaining its AccessibleContext
  17. * (see @link Accessible} and then calling the
  18. * {@link AccessibleContext#getAccessibleKeyBinding} method. If the return
  19. * value is not null, the object supports this interface.
  20. *
  21. * @see Accessible
  22. * @see Accessible#getAccessibleContext
  23. * @see AccessibleContext
  24. * @see AccessibleContext#getAccessibleKeyBinding
  25. *
  26. * @version 1.3 01/23/03
  27. * @author Lynn Monsanto
  28. */
  29. public interface AccessibleKeyBinding {
  30. /**
  31. * Returns the number of key bindings for this object
  32. *
  33. * @return the zero-based number of key bindings for this object
  34. */
  35. public int getAccessibleKeyBindingCount();
  36. /**
  37. * Returns a key binding for this object. The value returned is an
  38. * java.lang.Object which must be cast to appropriate type depending
  39. * on the underlying implementation of the key. For example, if the
  40. * Object returned is a javax.swing.KeyStroke, the user of this
  41. * method should do the following:
  42. * <nf><code>
  43. * Component c = <get the component that has the key bindings>
  44. * AccessibleContext ac = c.getAccessibleContext();
  45. * AccessibleKeyBinding akb = ac.getAccessibleKeyBinding();
  46. * for (int i = 0; i < akb.getAccessibleKeyBindingCount(); i++) {
  47. * Object o = akb.getAccessibleKeyBinding(i);
  48. * if (o instanceof javax.swing.KeyStroke) {
  49. * javax.swing.KeyStroke keyStroke = (javax.swing.KeyStroke)o;
  50. * <do something with the key binding>
  51. * }
  52. * }
  53. * </code></nf>
  54. *
  55. * @param i zero-based index of the key bindings
  56. * @return a javax.lang.Object which specifies the key binding
  57. * @see #getAccessibleKeyBindingCount
  58. */
  59. public java.lang.Object getAccessibleKeyBinding(int i);
  60. }