clearAccessibleSelection(); } } /** * Clears the selection in the object, so that no children in the * object are selected. * @since 1.3 */ public void clearAccessibleSelection() { JComboBox.this.setSelectedIndex(-1); } /** * Causes every child of the object to be selected * if the object supports multiple selections. * @since 1.3 */ public void selectAllAccessibleSelection() { // do nothing since multiple selection is not supported } // public Accessible getAccessibleAt(Point p) {// Accessible a = getAccessibleChild(1);// if ( a != null ) {// return a; // the editor// }// else {// return getAccessibleChild(0); // the list// }// } private EditorAccessibleContext editorAccessibleContext = null; private class AccessibleEditor implements Accessible { public AccessibleContext getAccessibleContext() { if (editorAccessibleContext == null) { Component c = JComboBox.this.getEditor().getEditorComponent(); if (c instanceof Accessible) { editorAccessibleContext = new EditorAccessibleContext((Accessible)c); } } return editorAccessibleContext; } } /* * Wrapper class for the AccessibleContext implemented by the * combo box editor. Delegates all method calls except * getAccessibleIndexInParent to the editor. The * getAccessibleIndexInParent method returns the selected * index in the combo box. */ private class EditorAccessibleContext extends AccessibleContext { private AccessibleContext ac; private EditorAccessibleContext() { } /* * @param a the AccessibleContext implemented by the * combo box editor */ EditorAccessibleContext(Accessible a) { this.ac = a.getAccessibleContext(); } /** * Gets the accessibleName property of this object. The accessibleName * property of an object is a localized String that designates the purpose * of the object. For example, the accessibleName property of a label * or button might be the text of the label or button itself. In the * case of an object that doesn't display its name, the accessibleName * should still be set. For example, in the case of a text field used * to enter the name of a city, the accessibleName for the en_US locale * could be 'city.' * * @return the localized name of the object; null if this * object does not have a name * * @see #setAccessibleName */ public String getAccessibleName() { return ac.getAccessibleName(); } /** * Sets the localized accessible name of this object. Changing the * name will cause a PropertyChangeEvent to be fired for the * ACCESSIBLE_NAME_PROPERTY property. * * @param s the new localized name of the object. * * @see #getAccessibleName * @see #addPropertyChangeListener * * @beaninfo * preferred: true * description: Sets the accessible name for the component. */ public void setAccessibleName(String s) { ac.setAccessibleName(s); } /** * Gets the accessibleDescription property of this object. The * accessibleDescription property of this object is a short localized * phrase describing the purpose of the object. For example, in the * case of a 'Cancel' button, the accessibleDescription could be * 'Ignore changes and close dialog box.' * * @return the localized description of the object; null if * this object does not have a description * * @see #setAccessibleDescription */ public String getAccessibleDescription() { return ac.getAccessibleDescription(); } /** * Sets the accessible description of this object. Changing the * name will cause a PropertyChangeEvent to be fired for the * ACCESSIBLE_DESCRIPTION_PROPERTY property. * * @param s the new localized description of the object * * @see #setAccessibleName * @see #addPropertyChangeListener * * @beaninfo * preferred: true * description: Sets the accessible description for the component. */ public void setAccessibleDescription(String s) { ac.setAccessibleDescription(s); } /** * Gets the role of this object. The role of the object is the generic * purpose or use of the class of this object. For example, the role * of a push button is AccessibleRole.PUSH_BUTTON. The roles in * AccessibleRole are provided so component developers can pick from * a set of predefined roles. This enables assistive technologies to * provide a consistent interface to various tweaked subclasses of * components (e.g., use AccessibleRole.PUSH_BUTTON for all components * that act like a push button) as well as distinguish between sublasses * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes * and AccessibleRole.RADIO_BUTTON for radio buttons). * <p>Note that the AccessibleRole class is also extensible, so * custom component developers can define their own AccessibleRole's * if the set of predefined roles is inadequate. * * @return an instance of AccessibleRole describing the role of the object * @see AccessibleRole */ public AccessibleRole getAccessibleRole() { return ac.getAccessibleRole(); } /** * Gets the state set of this object. The AccessibleStateSet of an object * is composed of a set of unique AccessibleStates. A change in the * AccessibleStateSet of an object will cause a PropertyChangeEvent to * be fired for the ACCESSIBLE_STATE_PROPERTY property. * * @return an instance of AccessibleStateSet containing the * current state set of the object * @see AccessibleStateSet * @see AccessibleState * @see #addPropertyChangeListener */ public AccessibleStateSet getAccessibleStateSet() { return ac.getAccessibleStateSet(); } /** * Gets the Accessible parent of this object. * * @return the Accessible parent of this object; null if this * object does not have an Accessible parent */ public Accessible getAccessibleParent() { return ac.getAccessibleParent(); } /** * Sets the Accessible parent of this object. This is meant to be used * only in the situations where the actual component's parent should * not be treated as the component's accessible parent and is a method * that should only be called by the parent of the accessible child. * * @param a - Accessible to be set as the parent */ public void setAccessibleParent(Accessible a) { ac.setAccessibleParent(a); } /** * Gets the 0-based index of this object in its accessible parent. * * @return the 0-based index of this object in its parent; -1 if this * object does not have an accessible parent. * * @see #getAccessibleParent * @see #getAccessibleChildrenCount * @see #getAccessibleChild */ public int getAccessibleIndexInParent() { return JComboBox.this.getSelectedIndex(); } /** * Returns the number of accessible children of the object. * * @return the number of accessible children of the object. */ public int getAccessibleChildrenCount() { return ac.getAccessibleChildrenCount(); } /** * Returns the specified Accessible child of the object. The Accessible * children of an Accessible object are zero-based, so the first child * of an Accessible child is at index 0, the second child is at index 1, * and so on. * * @param i zero-based index of child * @return the Accessible child of the object * @see #getAccessibleChildrenCount */ public Accessible getAccessibleChild(int i) { return ac.getAccessibleChild(i); } /** * Gets the locale of the component. If the component does not have a * locale, then the locale of its parent is returned. * * @return this component's locale. If this component does not have * a locale, the locale of its parent is returned. * * @exception IllegalComponentStateException * If the Component does not have its own locale and has not yet been * added to a containment hierarchy such that the locale can be * determined from the containing parent. */ public Locale getLocale() throws IllegalComponentStateException { return ac.getLocale(); } /** * Adds a PropertyChangeListener to the listener list. * The listener is registered for all Accessible properties and will * be called when those properties change. * * @see #ACCESSIBLE_NAME_PROPERTY * @see #ACCESSIBLE_DESCRIPTION_PROPERTY * @see #ACCESSIBLE_STATE_PROPERTY * @see #ACCESSIBLE_VALUE_PROPERTY * @see #ACCESSIBLE_SELECTION_PROPERTY * @see #ACCESSIBLE_TEXT_PROPERTY * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY * * @param listener The PropertyChangeListener to be added */ public void addPropertyChangeListener(PropertyChangeListener listener) { ac.addPropertyChangeListener(listener); } /** * Removes a PropertyChangeListener from the listener list. * This removes a PropertyChangeListener that was registered * for all properties. * * @param listener The PropertyChangeListener to be removed */ public void removePropertyChangeListener(PropertyChangeListener listener) { ac.removePropertyChangeListener(listener); } /** * Gets the AccessibleAction associated with this object that supports * one or more actions. * * @return AccessibleAction if supported by object; else return null * @see AccessibleAction */ public AccessibleAction getAccessibleAction() { return ac.getAccessibleAction(); } /** * Gets the AccessibleComponent associated with this object that has a * graphical representation. * * @return AccessibleComponent if supported by object; else return null * @see AccessibleComponent */ public AccessibleComponent getAccessibleComponent() { return ac.getAccessibleComponent(); } /** * Gets the AccessibleSelection associated with this object which allows its * Accessible children to be selected. * * @return AccessibleSelection if supported by object; else return null * @see AccessibleSelection */ public AccessibleSelection getAccessibleSelection() { return ac.getAccessibleSelection(); } /** * Gets the AccessibleText associated with this object presenting * text on the display. * * @return AccessibleText if supported by object; else return null * @see AccessibleText */ public AccessibleText getAccessibleText() { return ac.getAccessibleText(); } /** * Gets the AccessibleEditableText associated with this object * presenting editable text on the display. * * @return AccessibleEditableText if supported by object; else return null * @see AccessibleEditableText */ public AccessibleEditableText getAccessibleEditableText() { return ac.getAccessibleEditableText(); } /** * Gets the AccessibleValue associated with this object that supports a * Numerical value. * * @return AccessibleValue if supported by object; else return null * @see AccessibleValue */ public AccessibleValue getAccessibleValue() { return ac.getAccessibleValue(); } /** * Gets the AccessibleIcons associated with an object that has * one or more associated icons * * @return an array of AccessibleIcon if supported by object; * otherwise return null * @see AccessibleIcon */ public AccessibleIcon [] getAccessibleIcon() { return ac.getAccessibleIcon(); } /** * Gets the AccessibleRelationSet associated with an object * * @return an AccessibleRelationSet if supported by object; * otherwise return null * @see AccessibleRelationSet */ public AccessibleRelationSet getAccessibleRelationSet() { return ac.getAccessibleRelationSet(); } /** * Gets the AccessibleTable associated with an object * * @return an AccessibleTable if supported by object; * otherwise return null * @see AccessibleTable */ public AccessibleTable getAccessibleTable() { return ac.getAccessibleTable(); } /** * Support for reporting bound property changes. If oldValue and * newValue are not equal and the PropertyChangeEvent listener list * is not empty, then fire a PropertyChange event to each listener. * In general, this is for use by the Accessible objects themselves * and should not be called by an application program. * @param propertyName The programmatic name of the property that * was changed. * @param oldValue The old value of the property. * @param newValue The new value of the property. * @see java.beans.PropertyChangeSupport * @see #addPropertyChangeListener * @see #removePropertyChangeListener * @see #ACCESSIBLE_NAME_PROPERTY * @see #ACCESSIBLE_DESCRIPTION_PROPERTY * @see #ACCESSIBLE_STATE_PROPERTY * @see #ACCESSIBLE_VALUE_PROPERTY * @see #ACCESSIBLE_SELECTION_PROPERTY * @see #ACCESSIBLE_TEXT_PROPERTY * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY */ public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { ac.firePropertyChange(propertyName, oldValue, newValue); } } } // innerclass AccessibleJComboBox}Lines 2001–2412 of 2412. Previous lines
clearAccessibleSelection(); } } /** * Clears the selection in the object, so that no children in the * object are selected. * @since 1.3 */ public void clearAccessibleSelection() { JComboBox.this.setSelectedIndex(-1); } /** * Causes every child of the object to be selected * if the object supports multiple selections. * @since 1.3 */ public void selectAllAccessibleSelection() { // do nothing since multiple selection is not supported } // public Accessible getAccessibleAt(Point p) { // Accessible a = getAccessibleChild(1); // if ( a != null ) { // return a; // the editor // } // else { // return getAccessibleChild(0); // the list // } // } private EditorAccessibleContext editorAccessibleContext = null; private class AccessibleEditor implements Accessible { public AccessibleContext getAccessibleContext() { if (editorAccessibleContext == null) { Component c = JComboBox.this.getEditor().getEditorComponent(); if (c instanceof Accessible) { editorAccessibleContext = new EditorAccessibleContext((Accessible)c); } } return editorAccessibleContext; } } /* * Wrapper class for the AccessibleContext implemented by the * combo box editor. Delegates all method calls except * getAccessibleIndexInParent to the editor. The * getAccessibleIndexInParent method returns the selected * index in the combo box. */ private class EditorAccessibleContext extends AccessibleContext { private AccessibleContext ac; private EditorAccessibleContext() { } /* * @param a the AccessibleContext implemented by the * combo box editor */ EditorAccessibleContext(Accessible a) { this.ac = a.getAccessibleContext(); } /** * Gets the accessibleName property of this object. The accessibleName * property of an object is a localized String that designates the purpose * of the object. For example, the accessibleName property of a label * or button might be the text of the label or button itself. In the * case of an object that doesn't display its name, the accessibleName * should still be set. For example, in the case of a text field used * to enter the name of a city, the accessibleName for the en_US locale * could be 'city.' * * @return the localized name of the object; null if this * object does not have a name * * @see #setAccessibleName */ public String getAccessibleName() { return ac.getAccessibleName(); } /** * Sets the localized accessible name of this object. Changing the * name will cause a PropertyChangeEvent to be fired for the * ACCESSIBLE_NAME_PROPERTY property. * * @param s the new localized name of the object. * * @see #getAccessibleName * @see #addPropertyChangeListener * * @beaninfo * preferred: true * description: Sets the accessible name for the component. */ public void setAccessibleName(String s) { ac.setAccessibleName(s); } /** * Gets the accessibleDescription property of this object. The * accessibleDescription property of this object is a short localized * phrase describing the purpose of the object. For example, in the * case of a 'Cancel' button, the accessibleDescription could be * 'Ignore changes and close dialog box.' * * @return the localized description of the object; null if * this object does not have a description * * @see #setAccessibleDescription */ public String getAccessibleDescription() { return ac.getAccessibleDescription(); } /** * Sets the accessible description of this object. Changing the * name will cause a PropertyChangeEvent to be fired for the * ACCESSIBLE_DESCRIPTION_PROPERTY property. * * @param s the new localized description of the object * * @see #setAccessibleName * @see #addPropertyChangeListener * * @beaninfo * preferred: true * description: Sets the accessible description for the component. */ public void setAccessibleDescription(String s) { ac.setAccessibleDescription(s); } /** * Gets the role of this object. The role of the object is the generic * purpose or use of the class of this object. For example, the role * of a push button is AccessibleRole.PUSH_BUTTON. The roles in * AccessibleRole are provided so component developers can pick from * a set of predefined roles. This enables assistive technologies to * provide a consistent interface to various tweaked subclasses of * components (e.g., use AccessibleRole.PUSH_BUTTON for all components * that act like a push button) as well as distinguish between sublasses * that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes * and AccessibleRole.RADIO_BUTTON for radio buttons). * <p>Note that the AccessibleRole class is also extensible, so * custom component developers can define their own AccessibleRole's * if the set of predefined roles is inadequate. * * @return an instance of AccessibleRole describing the role of the object * @see AccessibleRole */ public AccessibleRole getAccessibleRole() { return ac.getAccessibleRole(); } /** * Gets the state set of this object. The AccessibleStateSet of an object * is composed of a set of unique AccessibleStates. A change in the * AccessibleStateSet of an object will cause a PropertyChangeEvent to * be fired for the ACCESSIBLE_STATE_PROPERTY property. * * @return an instance of AccessibleStateSet containing the * current state set of the object * @see AccessibleStateSet * @see AccessibleState * @see #addPropertyChangeListener */ public AccessibleStateSet getAccessibleStateSet() { return ac.getAccessibleStateSet(); } /** * Gets the Accessible parent of this object. * * @return the Accessible parent of this object; null if this * object does not have an Accessible parent */ public Accessible getAccessibleParent() { return ac.getAccessibleParent(); } /** * Sets the Accessible parent of this object. This is meant to be used * only in the situations where the actual component's parent should * not be treated as the component's accessible parent and is a method * that should only be called by the parent of the accessible child. * * @param a - Accessible to be set as the parent */ public void setAccessibleParent(Accessible a) { ac.setAccessibleParent(a); } /** * Gets the 0-based index of this object in its accessible parent. * * @return the 0-based index of this object in its parent; -1 if this * object does not have an accessible parent. * * @see #getAccessibleParent * @see #getAccessibleChildrenCount * @see #getAccessibleChild */ public int getAccessibleIndexInParent() { return JComboBox.this.getSelectedIndex(); } /** * Returns the number of accessible children of the object. * * @return the number of accessible children of the object. */ public int getAccessibleChildrenCount() { return ac.getAccessibleChildrenCount(); } /** * Returns the specified Accessible child of the object. The Accessible * children of an Accessible object are zero-based, so the first child * of an Accessible child is at index 0, the second child is at index 1, * and so on. * * @param i zero-based index of child * @return the Accessible child of the object * @see #getAccessibleChildrenCount */ public Accessible getAccessibleChild(int i) { return ac.getAccessibleChild(i); } /** * Gets the locale of the component. If the component does not have a * locale, then the locale of its parent is returned. * * @return this component's locale. If this component does not have * a locale, the locale of its parent is returned. * * @exception IllegalComponentStateException * If the Component does not have its own locale and has not yet been * added to a containment hierarchy such that the locale can be * determined from the containing parent. */ public Locale getLocale() throws IllegalComponentStateException { return ac.getLocale(); } /** * Adds a PropertyChangeListener to the listener list. * The listener is registered for all Accessible properties and will * be called when those properties change. * * @see #ACCESSIBLE_NAME_PROPERTY * @see #ACCESSIBLE_DESCRIPTION_PROPERTY * @see #ACCESSIBLE_STATE_PROPERTY * @see #ACCESSIBLE_VALUE_PROPERTY * @see #ACCESSIBLE_SELECTION_PROPERTY * @see #ACCESSIBLE_TEXT_PROPERTY * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY * * @param listener The PropertyChangeListener to be added */ public void addPropertyChangeListener(PropertyChangeListener listener) { ac.addPropertyChangeListener(listener); } /** * Removes a PropertyChangeListener from the listener list. * This removes a PropertyChangeListener that was registered * for all properties. * * @param listener The PropertyChangeListener to be removed */ public void removePropertyChangeListener(PropertyChangeListener listener) { ac.removePropertyChangeListener(listener); } /** * Gets the AccessibleAction associated with this object that supports * one or more actions. * * @return AccessibleAction if supported by object; else return null * @see AccessibleAction */ public AccessibleAction getAccessibleAction() { return ac.getAccessibleAction(); } /** * Gets the AccessibleComponent associated with this object that has a * graphical representation. * * @return AccessibleComponent if supported by object; else return null * @see AccessibleComponent */ public AccessibleComponent getAccessibleComponent() { return ac.getAccessibleComponent(); } /** * Gets the AccessibleSelection associated with this object which allows its * Accessible children to be selected. * * @return AccessibleSelection if supported by object; else return null * @see AccessibleSelection */ public AccessibleSelection getAccessibleSelection() { return ac.getAccessibleSelection(); } /** * Gets the AccessibleText associated with this object presenting * text on the display. * * @return AccessibleText if supported by object; else return null * @see AccessibleText */ public AccessibleText getAccessibleText() { return ac.getAccessibleText(); } /** * Gets the AccessibleEditableText associated with this object * presenting editable text on the display. * * @return AccessibleEditableText if supported by object; else return null * @see AccessibleEditableText */ public AccessibleEditableText getAccessibleEditableText() { return ac.getAccessibleEditableText(); } /** * Gets the AccessibleValue associated with this object that supports a * Numerical value. * * @return AccessibleValue if supported by object; else return null * @see AccessibleValue */ public AccessibleValue getAccessibleValue() { return ac.getAccessibleValue(); } /** * Gets the AccessibleIcons associated with an object that has * one or more associated icons * * @return an array of AccessibleIcon if supported by object; * otherwise return null * @see AccessibleIcon */ public AccessibleIcon [] getAccessibleIcon() { return ac.getAccessibleIcon(); } /** * Gets the AccessibleRelationSet associated with an object * * @return an AccessibleRelationSet if supported by object; * otherwise return null * @see AccessibleRelationSet */ public AccessibleRelationSet getAccessibleRelationSet() { return ac.getAccessibleRelationSet(); } /** * Gets the AccessibleTable associated with an object * * @return an AccessibleTable if supported by object; * otherwise return null * @see AccessibleTable */ public AccessibleTable getAccessibleTable() { return ac.getAccessibleTable(); } /** * Support for reporting bound property changes. If oldValue and * newValue are not equal and the PropertyChangeEvent listener list * is not empty, then fire a PropertyChange event to each listener. * In general, this is for use by the Accessible objects themselves * and should not be called by an application program. * @param propertyName The programmatic name of the property that * was changed. * @param oldValue The old value of the property. * @param newValue The new value of the property. * @see java.beans.PropertyChangeSupport * @see #addPropertyChangeListener * @see #removePropertyChangeListener * @see #ACCESSIBLE_NAME_PROPERTY * @see #ACCESSIBLE_DESCRIPTION_PROPERTY * @see #ACCESSIBLE_STATE_PROPERTY * @see #ACCESSIBLE_VALUE_PROPERTY * @see #ACCESSIBLE_SELECTION_PROPERTY * @see #ACCESSIBLE_TEXT_PROPERTY * @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY */ public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { ac.firePropertyChange(propertyName, oldValue, newValue); } } } // innerclass AccessibleJComboBox }