< prev index next >
src/java.desktop/share/classes/java/awt/Choice.java
Print this page
*** 34,44 ****
import javax.accessibility.*;
/**
! * The <code>Choice</code> class presents a pop-up menu of choices.
* The current choice is displayed as the title of the menu.
* <p>
* The following code example produces a pop-up menu:
*
* <hr><blockquote><pre>
--- 34,44 ----
import javax.accessibility.*;
/**
! * The {@code Choice} class presents a pop-up menu of choices.
* The current choice is displayed as the title of the menu.
* <p>
* The following code example produces a pop-up menu:
*
* <hr><blockquote><pre>
*** 52,81 ****
* it appears as follows in its normal state:
* <p>
* <img src="doc-files/Choice-1.gif" alt="The following text describes the graphic"
* style="float:center; margin: 7px 10px;">
* <p>
! * In the picture, <code>"Green"</code> is the current choice.
* Pushing the mouse button down on the object causes a menu to
* appear with the current choice highlighted.
* <p>
* Some native platforms do not support arbitrary resizing of
! * <code>Choice</code> components and the behavior of
! * <code>setSize()/getSize()</code> is bound by
* such limitations.
! * Native GUI <code>Choice</code> components' size are often bound by such
* attributes as font size and length of items contained within
! * the <code>Choice</code>.
*
* @author Sami Shaio
* @author Arthur van Hoff
* @since 1.0
*/
public class Choice extends Component implements ItemSelectable, Accessible {
/**
! * The items for the <code>Choice</code>.
! * This can be a <code>null</code> value.
* @serial
* @see #add(String)
* @see #addItem(String)
* @see #getItem(int)
* @see #getItemCount()
--- 52,81 ----
* it appears as follows in its normal state:
* <p>
* <img src="doc-files/Choice-1.gif" alt="The following text describes the graphic"
* style="float:center; margin: 7px 10px;">
* <p>
! * In the picture, {@code "Green"} is the current choice.
* Pushing the mouse button down on the object causes a menu to
* appear with the current choice highlighted.
* <p>
* Some native platforms do not support arbitrary resizing of
! * {@code Choice} components and the behavior of
! * {@code setSize()/getSize()} is bound by
* such limitations.
! * Native GUI {@code Choice} components' size are often bound by such
* attributes as font size and length of items contained within
! * the {@code Choice}.
*
* @author Sami Shaio
* @author Arthur van Hoff
* @since 1.0
*/
public class Choice extends Component implements ItemSelectable, Accessible {
/**
! * The items for the {@code Choice}.
! * This can be a {@code null} value.
* @serial
* @see #add(String)
* @see #addItem(String)
* @see #getItem(int)
* @see #getItemCount()
*** 83,93 ****
* @see #remove(String)
*/
Vector<String> pItems;
/**
! * The index of the current choice for this <code>Choice</code>
* or -1 if nothing is selected.
* @serial
* @see #getSelectedItem()
* @see #select(int)
*/
--- 83,93 ----
* @see #remove(String)
*/
Vector<String> pItems;
/**
! * The index of the current choice for this {@code Choice}
* or -1 if nothing is selected.
* @serial
* @see #getSelectedItem()
* @see #select(int)
*/
*** 115,125 ****
/**
* Creates a new choice menu. The menu initially has no items in it.
* <p>
* By default, the first item added to the choice menu becomes the
* selected item, until a different selection is made by the user
! * by calling one of the <code>select</code> methods.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #select(int)
* @see #select(java.lang.String)
--- 115,125 ----
/**
* Creates a new choice menu. The menu initially has no items in it.
* <p>
* By default, the first item added to the choice menu becomes the
* selected item, until a different selection is made by the user
! * by calling one of the {@code select} methods.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #select(int)
* @see #select(java.lang.String)
*** 129,150 ****
pItems = new Vector<>();
}
/**
* Constructs a name for this component. Called by
! * <code>getName</code> when the name is <code>null</code>.
*/
String constructComponentName() {
synchronized (Choice.class) {
return base + nameCounter++;
}
}
/**
! * Creates the <code>Choice</code>'s peer. This peer allows us
* to change the look
! * of the <code>Choice</code> without changing its functionality.
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
--- 129,150 ----
pItems = new Vector<>();
}
/**
* Constructs a name for this component. Called by
! * {@code getName} when the name is {@code null}.
*/
String constructComponentName() {
synchronized (Choice.class) {
return base + nameCounter++;
}
}
/**
! * Creates the {@code Choice}'s peer. This peer allows us
* to change the look
! * of the {@code Choice} without changing its functionality.
* @see java.awt.Component#getToolkit()
*/
public void addNotify() {
synchronized (getTreeLock()) {
if (peer == null)
*** 152,164 ****
super.addNotify();
}
}
/**
! * Returns the number of items in this <code>Choice</code> menu.
*
! * @return the number of items in this <code>Choice</code> menu
* @see #getItem
* @since 1.1
*/
public int getItemCount() {
return countItems();
--- 152,164 ----
super.addNotify();
}
}
/**
! * Returns the number of items in this {@code Choice} menu.
*
! * @return the number of items in this {@code Choice} menu
* @see #getItem
* @since 1.1
*/
public int getItemCount() {
return countItems();
*** 167,186 ****
/**
* Returns the number of items in this {@code Choice} menu.
*
* @return the number of items in this {@code Choice} menu
* @deprecated As of JDK version 1.1,
! * replaced by <code>getItemCount()</code>.
*/
@Deprecated
public int countItems() {
return pItems.size();
}
/**
* Gets the string at the specified index in this
! * <code>Choice</code> menu.
*
* @param index the index at which to begin
* @return the item at the specified index
* @see #getItemCount
*/
--- 167,186 ----
/**
* Returns the number of items in this {@code Choice} menu.
*
* @return the number of items in this {@code Choice} menu
* @deprecated As of JDK version 1.1,
! * replaced by {@code getItemCount()}.
*/
@Deprecated
public int countItems() {
return pItems.size();
}
/**
* Gets the string at the specified index in this
! * {@code Choice} menu.
*
* @param index the index at which to begin
* @return the item at the specified index
* @see #getItemCount
*/
*** 195,222 ****
final String getItemImpl(int index) {
return pItems.elementAt(index);
}
/**
! * Adds an item to this <code>Choice</code> menu.
* @param item the item to be added
* @exception NullPointerException if the item's value is
! * <code>null</code>
* @since 1.1
*/
public void add(String item) {
addItem(item);
}
/**
* Obsolete as of Java 2 platform v1.1. Please use the
! * <code>add</code> method instead.
* <p>
! * Adds an item to this <code>Choice</code> menu.
* @param item the item to be added
* @exception NullPointerException if the item's value is equal to
! * <code>null</code>
*/
public void addItem(String item) {
synchronized (this) {
insertNoInvalidate(item, pItems.size());
}
--- 195,222 ----
final String getItemImpl(int index) {
return pItems.elementAt(index);
}
/**
! * Adds an item to this {@code Choice} menu.
* @param item the item to be added
* @exception NullPointerException if the item's value is
! * {@code null}
* @since 1.1
*/
public void add(String item) {
addItem(item);
}
/**
* Obsolete as of Java 2 platform v1.1. Please use the
! * {@code add} method instead.
* <p>
! * Adds an item to this {@code Choice} menu.
* @param item the item to be added
* @exception NullPointerException if the item's value is equal to
! * {@code null}
*/
public void addItem(String item) {
synchronized (this) {
insertNoInvalidate(item, pItems.size());
}
*** 224,241 ****
// This could change the preferred size of the Component.
invalidateIfValid();
}
/**
! * Inserts an item to this <code>Choice</code>,
! * but does not invalidate the <code>Choice</code>.
* Client methods must provide their own synchronization before
* invoking this method.
* @param item the item to be added
* @param index the new item position
* @exception NullPointerException if the item's value is equal to
! * <code>null</code>
*/
private void insertNoInvalidate(String item, int index) {
if (item == null) {
throw new
NullPointerException("cannot add null item to Choice");
--- 224,241 ----
// This could change the preferred size of the Component.
invalidateIfValid();
}
/**
! * Inserts an item to this {@code Choice},
! * but does not invalidate the {@code Choice}.
* Client methods must provide their own synchronization before
* invoking this method.
* @param item the item to be added
* @param index the new item position
* @exception NullPointerException if the item's value is equal to
! * {@code null}
*/
private void insertNoInvalidate(String item, int index) {
if (item == null) {
throw new
NullPointerException("cannot add null item to Choice");
*** 253,274 ****
/**
* Inserts the item into this choice at the specified position.
* Existing items at an index greater than or equal to
! * <code>index</code> are shifted up by one to accommodate
! * the new item. If <code>index</code> is greater than or
* equal to the number of items in this choice,
! * <code>item</code> is added to the end of this choice.
* <p>
* If the item is the first one being added to the choice,
* then the item becomes selected. Otherwise, if the
* selected item was one of the items shifted, the first
* item in the choice becomes the selected item. If the
* selected item was no among those shifted, it remains
* the selected item.
! * @param item the non-<code>null</code> item to be inserted
* @param index the position at which the item should be inserted
* @exception IllegalArgumentException if index is less than 0
*/
public void insert(String item, int index) {
synchronized (this) {
--- 253,274 ----
/**
* Inserts the item into this choice at the specified position.
* Existing items at an index greater than or equal to
! * {@code index} are shifted up by one to accommodate
! * the new item. If {@code index} is greater than or
* equal to the number of items in this choice,
! * {@code item} is added to the end of this choice.
* <p>
* If the item is the first one being added to the choice,
* then the item becomes selected. Otherwise, if the
* selected item was one of the items shifted, the first
* item in the choice becomes the selected item. If the
* selected item was no among those shifted, it remains
* the selected item.
! * @param item the non-{@code null} item to be inserted
* @param index the position at which the item should be inserted
* @exception IllegalArgumentException if index is less than 0
*/
public void insert(String item, int index) {
synchronized (this) {
*** 284,301 ****
// This could change the preferred size of the Component.
invalidateIfValid();
}
/**
! * Removes the first occurrence of <code>item</code>
! * from the <code>Choice</code> menu. If the item
* being removed is the currently selected item,
* then the first item in the choice becomes the
* selected item. Otherwise, the currently selected
* item remains selected (and the selected index is
* updated accordingly).
! * @param item the item to remove from this <code>Choice</code> menu
* @exception IllegalArgumentException if the item doesn't
* exist in the choice menu
* @since 1.1
*/
public void remove(String item) {
--- 284,301 ----
// This could change the preferred size of the Component.
invalidateIfValid();
}
/**
! * Removes the first occurrence of {@code item}
! * from the {@code Choice} menu. If the item
* being removed is the currently selected item,
* then the first item in the choice becomes the
* selected item. Otherwise, the currently selected
* item remains selected (and the selected index is
* updated accordingly).
! * @param item the item to remove from this {@code Choice} menu
* @exception IllegalArgumentException if the item doesn't
* exist in the choice menu
* @since 1.1
*/
public void remove(String item) {
*** 334,345 ****
// This could change the preferred size of the Component.
invalidateIfValid();
}
/**
! * Removes an item from the <code>Choice</code> at the
! * specified position, but does not invalidate the <code>Choice</code>.
* Client methods must provide their
* own synchronization before invoking this method.
* @param position the position of the item
*/
private void removeNoInvalidate(int position) {
--- 334,345 ----
// This could change the preferred size of the Component.
invalidateIfValid();
}
/**
! * Removes an item from the {@code Choice} at the
! * specified position, but does not invalidate the {@code Choice}.
* Client methods must provide their
* own synchronization before invoking this method.
* @param position the position of the item
*/
private void removeNoInvalidate(int position) {
*** 387,397 ****
return (selectedIndex >= 0) ? getItem(selectedIndex) : null;
}
/**
* Returns an array (length 1) containing the currently selected
! * item. If this choice has no items, returns <code>null</code>.
* @see ItemSelectable
*/
public synchronized Object[] getSelectedObjects() {
if (selectedIndex >= 0) {
Object[] items = new Object[1];
--- 387,397 ----
return (selectedIndex >= 0) ? getItem(selectedIndex) : null;
}
/**
* Returns an array (length 1) containing the currently selected
! * item. If this choice has no items, returns {@code null}.
* @see ItemSelectable
*/
public synchronized Object[] getSelectedObjects() {
if (selectedIndex >= 0) {
Object[] items = new Object[1];
*** 412,429 ****
public int getSelectedIndex() {
return selectedIndex;
}
/**
! * Sets the selected item in this <code>Choice</code> menu to be the
* item at the specified position.
*
* <p>Note that this method should be primarily used to
* initially select an item in this component.
* Programmatically calling this method will <i>not</i> trigger
! * an <code>ItemEvent</code>. The only way to trigger an
! * <code>ItemEvent</code> is by user interaction.
*
* @param pos the position of the selected item
* @exception IllegalArgumentException if the specified
* position is greater than the
* number of items or less than zero
--- 412,429 ----
public int getSelectedIndex() {
return selectedIndex;
}
/**
! * Sets the selected item in this {@code Choice} menu to be the
* item at the specified position.
*
* <p>Note that this method should be primarily used to
* initially select an item in this component.
* Programmatically calling this method will <i>not</i> trigger
! * an {@code ItemEvent}. The only way to trigger an
! * {@code ItemEvent} is by user interaction.
*
* @param pos the position of the selected item
* @exception IllegalArgumentException if the specified
* position is greater than the
* number of items or less than zero
*** 442,461 ****
}
}
}
/**
! * Sets the selected item in this <code>Choice</code> menu
* to be the item whose name is equal to the specified string.
* If more than one item matches (is equal to) the specified string,
* the one with the smallest index is selected.
*
* <p>Note that this method should be primarily used to
* initially select an item in this component.
* Programmatically calling this method will <i>not</i> trigger
! * an <code>ItemEvent</code>. The only way to trigger an
! * <code>ItemEvent</code> is by user interaction.
*
* @param str the specified string
* @see #getSelectedItem
* @see #getSelectedIndex
*/
--- 442,461 ----
}
}
}
/**
! * Sets the selected item in this {@code Choice} menu
* to be the item whose name is equal to the specified string.
* If more than one item matches (is equal to) the specified string,
* the one with the smallest index is selected.
*
* <p>Note that this method should be primarily used to
* initially select an item in this component.
* Programmatically calling this method will <i>not</i> trigger
! * an {@code ItemEvent}. The only way to trigger an
! * {@code ItemEvent} is by user interaction.
*
* @param str the specified string
* @see #getSelectedItem
* @see #getSelectedIndex
*/
*** 466,478 ****
}
}
/**
* Adds the specified item listener to receive item events from
! * this <code>Choice</code> menu. Item events are sent in response
! * to user input, but not in response to calls to <code>select</code>.
! * If l is <code>null</code>, no exception is thrown and no action
* is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
* @param l the item listener
* @see #removeItemListener
--- 466,478 ----
}
}
/**
* Adds the specified item listener to receive item events from
! * this {@code Choice} menu. Item events are sent in response
! * to user input, but not in response to calls to {@code select}.
! * If l is {@code null}, no exception is thrown and no action
* is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
* @param l the item listener
* @see #removeItemListener
*** 490,501 ****
newEventsOnly = true;
}
/**
* Removes the specified item listener so that it no longer receives
! * item events from this <code>Choice</code> menu.
! * If l is <code>null</code>, no exception is thrown and no
* action is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
* @param l the item listener
* @see #addItemListener
--- 490,501 ----
newEventsOnly = true;
}
/**
* Removes the specified item listener so that it no longer receives
! * item events from this {@code Choice} menu.
! * If l is {@code null}, no exception is thrown and no
* action is performed.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
* @param l the item listener
* @see #addItemListener
*** 513,523 ****
/**
* Returns an array of all the item listeners
* registered on this choice.
*
! * @return all of this choice's <code>ItemListener</code>s
* or an empty array if no item
* listeners are currently registered
*
* @see #addItemListener
* @see #removeItemListener
--- 513,523 ----
/**
* Returns an array of all the item listeners
* registered on this choice.
*
! * @return all of this choice's {@code ItemListener}s
* or an empty array if no item
* listeners are currently registered
*
* @see #addItemListener
* @see #removeItemListener
*** 530,565 ****
}
/**
* Returns an array of all the objects currently registered
* as <code><em>Foo</em>Listener</code>s
! * upon this <code>Choice</code>.
* <code><em>Foo</em>Listener</code>s are registered using the
* <code>add<em>Foo</em>Listener</code> method.
*
* <p>
! * You can specify the <code>listenerType</code> argument
* with a class literal, such as
* <code><em>Foo</em>Listener.class</code>.
* For example, you can query a
! * <code>Choice</code> <code>c</code>
* for its item listeners with the following code:
*
* <pre>ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class));</pre>
*
* If no such listeners exist, this method returns an empty array.
*
* @param listenerType the type of listeners requested; this parameter
* should specify an interface that descends from
! * <code>java.util.EventListener</code>
* @return an array of all objects registered as
* <code><em>Foo</em>Listener</code>s on this choice,
* or an empty array if no such
* listeners have been added
! * @exception ClassCastException if <code>listenerType</code>
* doesn't specify a class or interface that implements
! * <code>java.util.EventListener</code>
*
* @see #getItemListeners
* @since 1.3
*/
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
--- 530,565 ----
}
/**
* Returns an array of all the objects currently registered
* as <code><em>Foo</em>Listener</code>s
! * upon this {@code Choice}.
* <code><em>Foo</em>Listener</code>s are registered using the
* <code>add<em>Foo</em>Listener</code> method.
*
* <p>
! * You can specify the {@code listenerType} argument
* with a class literal, such as
* <code><em>Foo</em>Listener.class</code>.
* For example, you can query a
! * {@code Choice c}
* for its item listeners with the following code:
*
* <pre>ItemListener[] ils = (ItemListener[])(c.getListeners(ItemListener.class));</pre>
*
* If no such listeners exist, this method returns an empty array.
*
* @param listenerType the type of listeners requested; this parameter
* should specify an interface that descends from
! * {@code java.util.EventListener}
* @return an array of all objects registered as
* <code><em>Foo</em>Listener</code>s on this choice,
* or an empty array if no such
* listeners have been added
! * @exception ClassCastException if {@code listenerType}
* doesn't specify a class or interface that implements
! * {@code java.util.EventListener}
*
* @see #getItemListeners
* @since 1.3
*/
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
*** 584,597 ****
return super.eventEnabled(e);
}
/**
* Processes events on this choice. If the event is an
! * instance of <code>ItemEvent</code>, it invokes the
! * <code>processItemEvent</code> method. Otherwise, it calls its
! * superclass's <code>processEvent</code> method.
! * <p>Note that if the event parameter is <code>null</code>
* the behavior is unspecified and may result in an
* exception.
*
* @param e the event
* @see java.awt.event.ItemEvent
--- 584,597 ----
return super.eventEnabled(e);
}
/**
* Processes events on this choice. If the event is an
! * instance of {@code ItemEvent}, it invokes the
! * {@code processItemEvent} method. Otherwise, it calls its
! * superclass's {@code processEvent} method.
! * <p>Note that if the event parameter is {@code null}
* the behavior is unspecified and may result in an
* exception.
*
* @param e the event
* @see java.awt.event.ItemEvent
*** 605,627 ****
}
super.processEvent(e);
}
/**
! * Processes item events occurring on this <code>Choice</code>
* menu by dispatching them to any registered
! * <code>ItemListener</code> objects.
* <p>
* This method is not called unless item events are
* enabled for this component. Item events are enabled
* when one of the following occurs:
* <ul>
! * <li>An <code>ItemListener</code> object is registered
! * via <code>addItemListener</code>.
! * <li>Item events are enabled via <code>enableEvents</code>.
* </ul>
! * <p>Note that if the event parameter is <code>null</code>
* the behavior is unspecified and may result in an
* exception.
*
* @param e the item event
* @see java.awt.event.ItemEvent
--- 605,627 ----
}
super.processEvent(e);
}
/**
! * Processes item events occurring on this {@code Choice}
* menu by dispatching them to any registered
! * {@code ItemListener} objects.
* <p>
* This method is not called unless item events are
* enabled for this component. Item events are enabled
* when one of the following occurs:
* <ul>
! * <li>An {@code ItemListener} object is registered
! * via {@code addItemListener}.
! * <li>Item events are enabled via {@code enableEvents}.
* </ul>
! * <p>Note that if the event parameter is {@code null}
* the behavior is unspecified and may result in an
* exception.
*
* @param e the item event
* @see java.awt.event.ItemEvent
*** 636,652 ****
listener.itemStateChanged(e);
}
}
/**
! * Returns a string representing the state of this <code>Choice</code>
* menu. This method is intended to be used only for debugging purposes,
* and the content and format of the returned string may vary between
* implementations. The returned string may be empty but may not be
! * <code>null</code>.
*
! * @return the parameter string of this <code>Choice</code> menu
*/
protected String paramString() {
return super.paramString() + ",current=" + getSelectedItem();
}
--- 636,652 ----
listener.itemStateChanged(e);
}
}
/**
! * Returns a string representing the state of this {@code Choice}
* menu. This method is intended to be used only for debugging purposes,
* and the content and format of the returned string may vary between
* implementations. The returned string may be empty but may not be
! * {@code null}.
*
! * @return the parameter string of this {@code Choice} menu
*/
protected String paramString() {
return super.paramString() + ",current=" + getSelectedItem();
}
*** 660,681 ****
*/
private int choiceSerializedDataVersion = 1;
/**
* Writes default serializable fields to stream. Writes
! * a list of serializable <code>ItemListeners</code>
* as optional data. The non-serializable
! * <code>ItemListeners</code> are detected and
* no attempt is made to serialize them.
*
! * @param s the <code>ObjectOutputStream</code> to write
! * @serialData <code>null</code> terminated sequence of 0
! * or more pairs; the pair consists of a <code>String</code>
! * and an <code>Object</code>; the <code>String</code> indicates
* the type of object and is one of the following:
! * <code>itemListenerK</code> indicating an
! * <code>ItemListener</code> object
*
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
* @see java.awt.Component#itemListenerK
* @see #readObject(ObjectInputStream)
*/
--- 660,681 ----
*/
private int choiceSerializedDataVersion = 1;
/**
* Writes default serializable fields to stream. Writes
! * a list of serializable {@code ItemListeners}
* as optional data. The non-serializable
! * {@code ItemListeners} are detected and
* no attempt is made to serialize them.
*
! * @param s the {@code ObjectOutputStream} to write
! * @serialData {@code null} terminated sequence of 0
! * or more pairs; the pair consists of a {@code String}
! * and an {@code Object}; the {@code String} indicates
* the type of object and is one of the following:
! * {@code itemListenerK} indicating an
! * {@code ItemListener} object
*
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
* @see java.awt.Component#itemListenerK
* @see #readObject(ObjectInputStream)
*/
*** 687,705 ****
AWTEventMulticaster.save(s, itemListenerK, itemListener);
s.writeObject(null);
}
/**
! * Reads the <code>ObjectInputStream</code> and if it
! * isn't <code>null</code> adds a listener to receive
! * item events fired by the <code>Choice</code> item.
* Unrecognized keys or values will be ignored.
*
! * @param s the <code>ObjectInputStream</code> to read
* @exception HeadlessException if
! * <code>GraphicsEnvironment.isHeadless</code> returns
! * <code>true</code>
* @serial
* @see #removeItemListener(ItemListener)
* @see #addItemListener(ItemListener)
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #writeObject(ObjectOutputStream)
--- 687,705 ----
AWTEventMulticaster.save(s, itemListenerK, itemListener);
s.writeObject(null);
}
/**
! * Reads the {@code ObjectInputStream} and if it
! * isn't {@code null} adds a listener to receive
! * item events fired by the {@code Choice} item.
* Unrecognized keys or values will be ignored.
*
! * @param s the {@code ObjectInputStream} to read
* @exception HeadlessException if
! * {@code GraphicsEnvironment.isHeadless} returns
! * {@code true}
* @serial
* @see #removeItemListener(ItemListener)
* @see #addItemListener(ItemListener)
* @see java.awt.GraphicsEnvironment#isHeadless
* @see #writeObject(ObjectOutputStream)
*** 731,748 ****
// Accessibility support
////////////////
/**
! * Gets the <code>AccessibleContext</code> associated with this
! * <code>Choice</code>. For <code>Choice</code> components,
! * the <code>AccessibleContext</code> takes the form of an
! * <code>AccessibleAWTChoice</code>. A new <code>AccessibleAWTChoice</code>
* instance is created if necessary.
*
! * @return an <code>AccessibleAWTChoice</code> that serves as the
! * <code>AccessibleContext</code> of this <code>Choice</code>
* @since 1.3
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleAWTChoice();
--- 731,748 ----
// Accessibility support
////////////////
/**
! * Gets the {@code AccessibleContext} associated with this
! * {@code Choice}. For {@code Choice} components,
! * the {@code AccessibleContext} takes the form of an
! * {@code AccessibleAWTChoice}. A new {@code AccessibleAWTChoice}
* instance is created if necessary.
*
! * @return an {@code AccessibleAWTChoice} that serves as the
! * {@code AccessibleContext} of this {@code Choice}
* @since 1.3
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleAWTChoice();
*** 750,760 ****
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * <code>Choice</code> class. It provides an implementation of the
* Java Accessibility API appropriate to choice user-interface elements.
* @since 1.3
*/
protected class AccessibleAWTChoice extends AccessibleAWTComponent
implements AccessibleAction
--- 750,760 ----
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * {@code Choice} class. It provides an implementation of the
* Java Accessibility API appropriate to choice user-interface elements.
* @since 1.3
*/
protected class AccessibleAWTChoice extends AccessibleAWTComponent
implements AccessibleAction
< prev index next >