} // ----- AccessibleExtendedComponent /** * Returns the AccessibleExtendedComponent * * @return the AccessibleExtendedComponent */ AccessibleExtendedComponent getAccessibleExtendedComponent() { return this; } /** * Returns the tool tip text * * @return the tool tip text, if supported, of the object; * otherwise, null * @since 1.4 */ public String getToolTipText() { return AbstractButton.this.getToolTipText(); } /** * Returns the titled border text * * @return the titled border text, if supported, of the object; * otherwise, null * @since 1.4 */ public String getTitledBorderText() { return super.getTitledBorderText(); } /** * Returns key bindings associated with this object * * @return the key bindings, if supported, of the object; * otherwise, null * @see AccessibleKeyBinding * @since 1.4 */ public AccessibleKeyBinding getAccessibleKeyBinding() { int mnemonic = AbstractButton.this.getMnemonic(); if (mnemonic == 0) { return null; } return new ButtonKeyBinding(mnemonic); } class ButtonKeyBinding implements AccessibleKeyBinding { int mnemonic; ButtonKeyBinding(int mnemonic) { this.mnemonic = mnemonic; } /** * Returns the number of key bindings for this object * * @return the zero-based number of key bindings for this object */ public int getAccessibleKeyBindingCount() { return 1; } /** * Returns a key binding for this object. The value returned is an * java.lang.Object which must be cast to appropriate type depending * on the underlying implementation of the key. For example, if the * Object returned is a javax.swing.KeyStroke, the user of this * method should do the following: * <nf><code> * Component c = <get the component that has the key bindings> * AccessibleContext ac = c.getAccessibleContext(); * AccessibleKeyBinding akb = ac.getAccessibleKeyBinding(); * for (int i = 0; i < akb.getAccessibleKeyBindingCount(); i++) { * Object o = akb.getAccessibleKeyBinding(i); * if (o instanceof javax.swing.KeyStroke) { * javax.swing.KeyStroke keyStroke = (javax.swing.KeyStroke)o; * <do something with the key binding> * } * } * </code></nf> * * @param i zero-based index of the key bindings * @return a javax.lang.Object which specifies the key binding * @exception IllegalArgumentException if the index is * out of bounds * @see #getAccessibleKeyBindingCount */ public java.lang.Object getAccessibleKeyBinding(int i) { if (i != 0) { throw new IllegalArgumentException(); } return KeyStroke.getKeyStroke(mnemonic, 0); } } }}Lines 3001–3101 of 3101. Previous lines
} // ----- AccessibleExtendedComponent /** * Returns the AccessibleExtendedComponent * * @return the AccessibleExtendedComponent */ AccessibleExtendedComponent getAccessibleExtendedComponent() { return this; } /** * Returns the tool tip text * * @return the tool tip text, if supported, of the object; * otherwise, null * @since 1.4 */ public String getToolTipText() { return AbstractButton.this.getToolTipText(); } /** * Returns the titled border text * * @return the titled border text, if supported, of the object; * otherwise, null * @since 1.4 */ public String getTitledBorderText() { return super.getTitledBorderText(); } /** * Returns key bindings associated with this object * * @return the key bindings, if supported, of the object; * otherwise, null * @see AccessibleKeyBinding * @since 1.4 */ public AccessibleKeyBinding getAccessibleKeyBinding() { int mnemonic = AbstractButton.this.getMnemonic(); if (mnemonic == 0) { return null; } return new ButtonKeyBinding(mnemonic); } class ButtonKeyBinding implements AccessibleKeyBinding { int mnemonic; ButtonKeyBinding(int mnemonic) { this.mnemonic = mnemonic; } /** * Returns the number of key bindings for this object * * @return the zero-based number of key bindings for this object */ public int getAccessibleKeyBindingCount() { return 1; } /** * Returns a key binding for this object. The value returned is an * java.lang.Object which must be cast to appropriate type depending * on the underlying implementation of the key. For example, if the * Object returned is a javax.swing.KeyStroke, the user of this * method should do the following: * <nf><code> * Component c = <get the component that has the key bindings> * AccessibleContext ac = c.getAccessibleContext(); * AccessibleKeyBinding akb = ac.getAccessibleKeyBinding(); * for (int i = 0; i < akb.getAccessibleKeyBindingCount(); i++) { * Object o = akb.getAccessibleKeyBinding(i); * if (o instanceof javax.swing.KeyStroke) { * javax.swing.KeyStroke keyStroke = (javax.swing.KeyStroke)o; * <do something with the key binding> * } * } * </code></nf> * * @param i zero-based index of the key bindings * @return a javax.lang.Object which specifies the key binding * @exception IllegalArgumentException if the index is * out of bounds * @see #getAccessibleKeyBindingCount */ public java.lang.Object getAccessibleKeyBinding(int i) { if (i != 0) { throw new IllegalArgumentException(); } return KeyStroke.getKeyStroke(mnemonic, 0); } } } }