< prev index next >

## src/java.desktop/share/classes/javax/swing/JComboBox.java

Print this page

    rev 48858 : Work in progress for JDK-6303622
    Use generic in Swing components like JComboBox
    1. Added generic return type and parameter type for JComboBox.
    2. Modified JList related classes as well.
    3. Reverted the changes made to "getSelectedValues" as suggested by Joe.
    4. Modified files that were failing on Linux and Mac as well.

     141      * This protected field is implementation specific. Do not access directly
     142      * or override. Use the accessor methods instead.
     143      *
     144      * @see #setActionCommand
     145      * @see #getActionCommand
     146      */
     147     protected String actionCommand = "comboBoxChanged";
     148     /**
     149      * This protected field is implementation specific. Do not access directly
     150      * or override. Use the accessor methods instead.
     151      *
     152      * @see #setLightWeightPopupEnabled
     153      * @see #isLightWeightPopupEnabled
     154      */
     155     protected boolean lightWeightPopupEnabled = JPopupMenu.getDefaultLightWeightPopupEnabled();
     156
     157     /**
     158      * This protected field is implementation specific. Do not access directly
     159      * or override.
     160      */
     161     protected Object selectedItemReminder = null;
     162
     163     private E prototypeDisplayValue;
     164
     165     // Flag to ensure that infinite loops do not occur with ActionEvents.
     166     private boolean firingActionEvent = false;
     167
     168     // Flag to ensure the we don't get multiple ActionEvents on item selection.
     169     private boolean selectingItem = false;
     170
     171     // Flag to indicate UI update is in progress
     172     private transient boolean updateInProgress;
     173
     174     /**
     175      * Creates a <code>JComboBox</code> that takes its items from an
     176      * existing <code>ComboBoxModel</code>.  Since the
     177      * <code>ComboBoxModel</code> is provided, a combo box created using
     178      * this constructor does not create a default combo box model and
     179      * may impact how the insert, remove and add methods behave.
     180      *
     181      * @param aModel the <code>ComboBoxModel</code> that provides the
     527      * the argument.
     528      * If <code>anObject</code> is in the list, the display area shows
     529      * <code>anObject</code> selected.
     530      * <p>
     531      * If <code>anObject</code> is <i>not</i> in the list and the combo box is
     532      * uneditable, it will not change the current selection. For editable
     533      * combo boxes, the selection will change to <code>anObject</code>.
     534      * <p>
     535      * If this constitutes a change in the selected item,
     536      * <code>ItemListener</code>s added to the combo box will be notified with
     537      * one or two <code>ItemEvent</code>s.
     538      * If there is a current selected item, an <code>ItemEvent</code> will be
     539      * fired and the state change will be <code>ItemEvent.DESELECTED</code>.
     540      * If <code>anObject</code> is in the list and is not currently selected
     541      * then an <code>ItemEvent</code> will be fired and the state change will
     542      * be <code>ItemEvent.SELECTED</code>.
     543      * <p>
     544      * <code>ActionListener</code>s added to the combo box will be notified
     545      * with an <code>ActionEvent</code> when this method is called.
     546      *

     547      * @param anObject  the list object to select; use <code>null</code> to
     548                         clear the selection
     549      */
     550     @BeanProperty(bound = false, preferred = true, description
     551             = "Sets the selected item in the JComboBox.")
     552     public void setSelectedItem(Object anObject) {
     553         Object oldSelection = selectedItemReminder;
     554         Object objectToSelect = anObject;
     555         if (oldSelection == null || !oldSelection.equals(anObject)) {
     556
     557             if (anObject != null && !isEditable()) {
     558                 // For non editable combo boxes, an invalid selection
     559                 // will be rejected.
     560                 boolean found = false;
     561                 for (int i = 0; i < dataModel.getSize(); i++) {
     562                     E element = dataModel.getElementAt(i);
     563                     if (anObject.equals(element)) {
     564                         found = true;
     565                         objectToSelect = element;
     566                         break;
     567                     }
     568                 }
     569                 if (!found) {
     570                     return;
     571                 }
     572
     573                 getEditor().setItem(anObject);
     574             }
     579             dataModel.setSelectedItem(objectToSelect);
     580             selectingItem = false;
     581
     582             if (selectedItemReminder != dataModel.getSelectedItem()) {
     583                 // in case a users implementation of ComboBoxModel
     584                 // doesn't fire a ListDataEvent when the selection
     585                 // changes.
     586                 selectedItemChanged();
     587             }
     588         }
     589         fireActionEvent();
     590     }
     591
     592     /**
     593      * Returns the current selected item.
     594      * <p>
     595      * If the combo box is editable, then this value may not have been added
     596      * to the combo box with <code>addItem</code>, <code>insertItemAt</code>
     597      * or the data constructors.
     598      *

     599      * @return the current selected Object
     600      * @see #setSelectedItem
     601      */
     602     public Object getSelectedItem() {
     603         return dataModel.getSelectedItem();
     604     }
     605
     606     /**
     607      * Selects the item at index <code>anIndex</code>.
     608      *
     609      * @param anIndex an integer specifying the list item to select,
     610      *                  where 0 specifies the first item in the list and -1 indicates no selection
     611      * @exception IllegalArgumentException if <code>anIndex</code> &lt; -1 or
     612      *                  <code>anIndex</code> is greater than or equal to size
     613      */
     614     @BeanProperty(bound = false, preferred = true, description
     615             = "The item at index is selected.")
     616     public void setSelectedIndex(int anIndex) {
     617         int size = dataModel.getSize();
     618
     619         if ( anIndex == -1 ) {
     620             setSelectedItem( null );
     621         } else if ( anIndex < -1 || anIndex >= size ) {
     622             throw new IllegalArgumentException("setSelectedIndex: " + anIndex + " out of bounds");
     623         } else {
     624             setSelectedItem(dataModel.getElementAt(anIndex));
     625         }
     626     }
     627
     628     /**
     629      * Returns the first item in the list that matches the given item.
     630      * The result is not always defined if the <code>JComboBox</code>
     631      * allows selected items that are not in the list.
     632      * Returns -1 if there is no selected item or if the user specified
     633      * an item which is not in the list.
     634
     635      * @return an integer specifying the currently selected list item,
     636      *                  where 0 specifies
     637      *                  the first item in the list;
     638      *                  or -1 if no item is selected or if
     639      *                  the currently selected item is not in the list
     640      */
     641     @Transient
     642     public int getSelectedIndex() {
     643         Object sObject = dataModel.getSelectedItem();
     644         int i,c;
     645         E obj;
     646
     647         for ( i=0,c=dataModel.getSize();i<c;i++ ) {
     648             obj = dataModel.getElementAt(i);
     649             if ( obj != null && obj.equals(sObject) )
     650                 return i;
     651         }
     652         return -1;
     653     }
     654
     655     /**
     656      * Returns the "prototypical display" value - an Object used
     657      * for the calculation of the display height and width.
     658      *
     659      * @return the value of the <code>prototypeDisplayValue</code> property
     660      * @see #setPrototypeDisplayValue
     661      * @since 1.4
     662      */
     663     public E getPrototypeDisplayValue() {
     664         return prototypeDisplayValue;
     665     }
     666
     667     /**
     668      * Sets the prototype display value used to calculate the size of the display
     719     /**
     720      * Inserts an item into the item list at a given index.
     721      * This method works only if the <code>JComboBox</code> uses a
     722      * mutable data model.
     723      *
     724      * @param item the item to add to the list
     725      * @param index    an integer specifying the position at which
     726      *                  to add the item
     727      * @see MutableComboBoxModel
     728      */
     729     public void insertItemAt(E item, int index) {
     730         checkMutableComboBoxModel();
     731         ((MutableComboBoxModel<E>)dataModel).insertElementAt(item,index);
     732     }
     733
     734     /**
     735      * Removes an item from the item list.
     736      * This method works only if the <code>JComboBox</code> uses a
     737      * mutable data model.
     738      *

     739      * @param anObject  the object to remove from the item list
     740      * @see MutableComboBoxModel
     741      */
     742     public void removeItem(Object anObject) {
     743         checkMutableComboBoxModel();
     744         ((MutableComboBoxModel)dataModel).removeElement(anObject);
     745     }
     746
     747     /**
     748      * Removes the item at <code>anIndex</code>
     749      * This method works only if the <code>JComboBox</code> uses a
     750      * mutable data model.
     751      *
     752      * @param anIndex  an int specifying the index of the item to remove,
     753      *                  where 0
     754      *                  indicates the first item in the list
     755      * @see MutableComboBoxModel
     756      */
     757     public void removeItemAt(int anIndex) {
     758         checkMutableComboBoxModel();
     759         ((MutableComboBoxModel<E>)dataModel).removeElementAt( anIndex );
     760     }
     761
     762     /**
     763      * Removes all items from the item list.
     764      */
    1279             fireItemStateChanged(new ItemEvent(this,ItemEvent.ITEM_STATE_CHANGED,
    1280                                                selectedItemReminder,
    1281                                                ItemEvent.DESELECTED));
    1282         }
    1283
    1284         // set the new selected item.
    1285         selectedItemReminder = dataModel.getSelectedItem();
    1286
    1287         if (selectedItemReminder != null ) {
    1288             fireItemStateChanged(new ItemEvent(this,ItemEvent.ITEM_STATE_CHANGED,
    1289                                                selectedItemReminder,
    1290                                                ItemEvent.SELECTED));
    1291         }
    1292     }
    1293
    1294     /**
    1295      * Returns an array containing the selected item.
    1296      * This method is implemented for compatibility with
    1297      * <code>ItemSelectable</code>.
    1298      *

    1299      * @return an array of <code>Objects</code> containing one
    1300      *          element -- the selected item
    1301      */
    1302     @BeanProperty(bound = false)
    1303     public Object[] getSelectedObjects() {
    1304         Object selectedObject = getSelectedItem();
    1305         if ( selectedObject == null )
    1306             return new Object[0];

    1307         else {
    1308             Object result[] = new Object[1];
    1309             result[0] = selectedObject;
    1310             return result;
    1311         }

    1312     }
    1313
    1314     /**
    1315      * This method is public as an implementation side effect.
    1316      * do not call or override.
    1317      */

    1318     public void actionPerformed(ActionEvent e) {
    1319         setPopupVisible(false);
    1320         getModel().setSelectedItem(getEditor().getItem());
    1321         String oldCommand = getActionCommand();
    1322         setActionCommand("comboBoxEdited");
    1323         fireActionEvent();
    1324         setActionCommand(oldCommand);
    1325     }
    1326
    1327     /**
    1328      * This method is public as an implementation side effect.
    1329      * do not call or override.
    1330      */
    1331     public void contentsChanged(ListDataEvent e) {
    1332         Object oldSelection = selectedItemReminder;
    1333         Object newSelection = dataModel.getSelectedItem();
    1334         if (oldSelection == null || !oldSelection.equals(newSelection)) {
    1335             selectedItemChanged();
    1336             if (!selectingItem) {
    1337                 fireActionEvent();
    1338             }
    1339         }
    1340     }
    1341
    1342     /**
    1343      * This method is public as an implementation side effect.
    1344      * do not call or override.
    1345      */
    1346     public void intervalAdded(ListDataEvent e) {
    1347         if (selectedItemReminder != dataModel.getSelectedItem()) {
    1348             selectedItemChanged();
    1349         }
    1350     }
    1351
    1352     /**
    1353      * This method is public as an implementation side effect.
    1927         /**
    1928          * Get the AccessibleSelection associated with this object.  In the
    1929          * implementation of the Java Accessibility API for this class,
    1930          * return this object, which is responsible for implementing the
    1931          * AccessibleSelection interface on behalf of itself.
    1932          *
    1933          * @return this object
    1934          */
    1935         public AccessibleSelection getAccessibleSelection() {
    1936             return this;
    1937         }
    1938
    1939         /**
    1940          * Returns the number of Accessible children currently selected.
    1941          * If no children are selected, the return value will be 0.
    1942          *
    1943          * @return the number of items currently selected.
    1944          * @since 1.3
    1945          */
    1946         public int getAccessibleSelectionCount() {
    1947             Object o = JComboBox.this.getSelectedItem();
    1948             if (o != null) {
    1949                 return 1;
    1950             } else {
    1951                 return 0;
    1952             }
    1953         }
    1954
    1955         /**
    1956          * Returns an Accessible representing the specified selected child
    1957          * in the popup.  If there isn't a selection, or there are
    1958          * fewer children selected than the integer passed in, the return
    1959          * value will be null.
    1960          * <p>Note that the index represents the i-th selected child, which
    1961          * is different from the i-th child.
    1962          *
    1963          * @param i the zero-based index of selected children
    1964          * @return the i-th selected child
    1965          * @see #getAccessibleSelectionCount
    1966          * @since 1.3
    1967          */
     141      * This protected field is implementation specific. Do not access directly
     142      * or override. Use the accessor methods instead.
     143      *
     144      * @see #setActionCommand
     145      * @see #getActionCommand
     146      */
     147     protected String actionCommand = "comboBoxChanged";
     148     /**
     149      * This protected field is implementation specific. Do not access directly
     150      * or override. Use the accessor methods instead.
     151      *
     152      * @see #setLightWeightPopupEnabled
     153      * @see #isLightWeightPopupEnabled
     154      */
     155     protected boolean lightWeightPopupEnabled = JPopupMenu.getDefaultLightWeightPopupEnabled();
     156
     157     /**
     158      * This protected field is implementation specific. Do not access directly
     159      * or override.
     160      */
     161     protected E selectedItemReminder = null;
     162
     163     private E prototypeDisplayValue;
     164
     165     // Flag to ensure that infinite loops do not occur with ActionEvents.
     166     private boolean firingActionEvent = false;
     167
     168     // Flag to ensure the we don't get multiple ActionEvents on item selection.
     169     private boolean selectingItem = false;
     170
     171     // Flag to indicate UI update is in progress
     172     private transient boolean updateInProgress;
     173
     174     /**
     175      * Creates a <code>JComboBox</code> that takes its items from an
     176      * existing <code>ComboBoxModel</code>.  Since the
     177      * <code>ComboBoxModel</code> is provided, a combo box created using
     178      * this constructor does not create a default combo box model and
     179      * may impact how the insert, remove and add methods behave.
     180      *
     181      * @param aModel the <code>ComboBoxModel</code> that provides the
     527      * the argument.
     528      * If <code>anObject</code> is in the list, the display area shows
     529      * <code>anObject</code> selected.
     530      * <p>
     531      * If <code>anObject</code> is <i>not</i> in the list and the combo box is
     532      * uneditable, it will not change the current selection. For editable
     533      * combo boxes, the selection will change to <code>anObject</code>.
     534      * <p>
     535      * If this constitutes a change in the selected item,
     536      * <code>ItemListener</code>s added to the combo box will be notified with
     537      * one or two <code>ItemEvent</code>s.
     538      * If there is a current selected item, an <code>ItemEvent</code> will be
     539      * fired and the state change will be <code>ItemEvent.DESELECTED</code>.
     540      * If <code>anObject</code> is in the list and is not currently selected
     541      * then an <code>ItemEvent</code> will be fired and the state change will
     542      * be <code>ItemEvent.SELECTED</code>.
     543      * <p>
     544      * <code>ActionListener</code>s added to the combo box will be notified
     545      * with an <code>ActionEvent</code> when this method is called.
     546      *
     547      * @param <E> the type of the elements of this comboBox.
     548      * @param anObject  the list object to select; use <code>null</code> to
     549                         clear the selection
     550      */
     551     @BeanProperty(bound = false, preferred = true, description
     552             = "Sets the selected item in the JComboBox.")
     553     public void setSelectedItem(E anObject) {
     554         E oldSelection = selectedItemReminder;
     555         E objectToSelect = anObject;
     556         if (oldSelection == null || !oldSelection.equals(anObject)) {
     557
     558             if (anObject != null && !isEditable()) {
     559                 // For non editable combo boxes, an invalid selection
     560                 // will be rejected.
     561                 boolean found = false;
     562                 for (int i = 0; i < dataModel.getSize(); i++) {
     563                     E element = dataModel.getElementAt(i);
     564                     if (anObject.equals(element)) {
     565                         found = true;
     566                         objectToSelect = element;
     567                         break;
     568                     }
     569                 }
     570                 if (!found) {
     571                     return;
     572                 }
     573
     574                 getEditor().setItem(anObject);
     575             }
     580             dataModel.setSelectedItem(objectToSelect);
     581             selectingItem = false;
     582
     583             if (selectedItemReminder != dataModel.getSelectedItem()) {
     584                 // in case a users implementation of ComboBoxModel
     585                 // doesn't fire a ListDataEvent when the selection
     586                 // changes.
     587                 selectedItemChanged();
     588             }
     589         }
     590         fireActionEvent();
     591     }
     592
     593     /**
     594      * Returns the current selected item.
     595      * <p>
     596      * If the combo box is editable, then this value may not have been added
     597      * to the combo box with <code>addItem</code>, <code>insertItemAt</code>
     598      * or the data constructors.
     599      *
     600      * @param <E> the type of the elements of comboBox.
     601      * @return the current selected Object
     602      * @see #setSelectedItem
     603      */
     604     public E getSelectedItem() {
     605         return dataModel.getSelectedItem();
     606     }
     607
     608     /**
     609      * Selects the item at index <code>anIndex</code>.
     610      *
     611      * @param anIndex an integer specifying the list item to select,
     612      *                  where 0 specifies the first item in the list and -1 indicates no selection
     613      * @exception IllegalArgumentException if <code>anIndex</code> &lt; -1 or
     614      *                  <code>anIndex</code> is greater than or equal to size
     615      */
     616     @BeanProperty(bound = false, preferred = true, description
     617             = "The item at index is selected.")
     618     public void setSelectedIndex(int anIndex) {
     619         int size = dataModel.getSize();
     620
     621         if ( anIndex == -1 ) {
     622             setSelectedItem( null );
     623         } else if ( anIndex < -1 || anIndex >= size ) {
     624             throw new IllegalArgumentException("setSelectedIndex: " + anIndex + " out of bounds");
     625         } else {
     626             setSelectedItem(dataModel.getElementAt(anIndex));
     627         }
     628     }
     629
     630     /**
     631      * Returns the first item in the list that matches the given item.
     632      * The result is not always defined if the <code>JComboBox</code>
     633      * allows selected items that are not in the list.
     634      * Returns -1 if there is no selected item or if the user specified
     635      * an item which is not in the list.
     636
     637      * @return an integer specifying the currently selected list item,
     638      *                  where 0 specifies
     639      *                  the first item in the list;
     640      *                  or -1 if no item is selected or if
     641      *                  the currently selected item is not in the list
     642      */
     643     @Transient
     644     public int getSelectedIndex() {
     645         E sObject = dataModel.getSelectedItem();

     646
     647         for ( int i=0,c=dataModel.getSize();i<c;i++ ) {
     648             E obj = dataModel.getElementAt(i);
     649             if ( obj != null && obj.equals(sObject) )
     650                 return i;
     651         }
     652         return -1;
     653     }
     654
     655     /**
     656      * Returns the "prototypical display" value - an Object used
     657      * for the calculation of the display height and width.
     658      *
     659      * @return the value of the <code>prototypeDisplayValue</code> property
     660      * @see #setPrototypeDisplayValue
     661      * @since 1.4
     662      */
     663     public E getPrototypeDisplayValue() {
     664         return prototypeDisplayValue;
     665     }
     666
     667     /**
     668      * Sets the prototype display value used to calculate the size of the display
     719     /**
     720      * Inserts an item into the item list at a given index.
     721      * This method works only if the <code>JComboBox</code> uses a
     722      * mutable data model.
     723      *
     724      * @param item the item to add to the list
     725      * @param index    an integer specifying the position at which
     726      *                  to add the item
     727      * @see MutableComboBoxModel
     728      */
     729     public void insertItemAt(E item, int index) {
     730         checkMutableComboBoxModel();
     731         ((MutableComboBoxModel<E>)dataModel).insertElementAt(item,index);
     732     }
     733
     734     /**
     735      * Removes an item from the item list.
     736      * This method works only if the <code>JComboBox</code> uses a
     737      * mutable data model.
     738      *
     739      * @param <E> the type of the elements of this comboBox.
     740      * @param anObject  the object to remove from the item list
     741      * @see MutableComboBoxModel
     742      */
     743     public void removeItem(E anObject) {
     744         checkMutableComboBoxModel();
     745         ((MutableComboBoxModel<E>)dataModel).removeElement(anObject);
     746     }
     747
     748     /**
     749      * Removes the item at <code>anIndex</code>
     750      * This method works only if the <code>JComboBox</code> uses a
     751      * mutable data model.
     752      *
     753      * @param anIndex  an int specifying the index of the item to remove,
     754      *                  where 0
     755      *                  indicates the first item in the list
     756      * @see MutableComboBoxModel
     757      */
     758     public void removeItemAt(int anIndex) {
     759         checkMutableComboBoxModel();
     760         ((MutableComboBoxModel<E>)dataModel).removeElementAt( anIndex );
     761     }
     762
     763     /**
     764      * Removes all items from the item list.
     765      */
    1280             fireItemStateChanged(new ItemEvent(this,ItemEvent.ITEM_STATE_CHANGED,
    1281                                                selectedItemReminder,
    1282                                                ItemEvent.DESELECTED));
    1283         }
    1284
    1285         // set the new selected item.
    1286         selectedItemReminder = dataModel.getSelectedItem();
    1287
    1288         if (selectedItemReminder != null ) {
    1289             fireItemStateChanged(new ItemEvent(this,ItemEvent.ITEM_STATE_CHANGED,
    1290                                                selectedItemReminder,
    1291                                                ItemEvent.SELECTED));
    1292         }
    1293     }
    1294
    1295     /**
    1296      * Returns an array containing the selected item.
    1297      * This method is implemented for compatibility with
    1298      * <code>ItemSelectable</code>.
    1299      *
    1300      * @param <E> the type of the elements of this comboBox.
    1301      * @return an array of <code>Objects</code> containing one
    1302      *          element -- the selected item
    1303      */
    1304     @BeanProperty(bound = false)
    1305     public Object[] getSelectedObjects() {
    1306         E selectedObject = getSelectedItem();
    1307         Object[] result = null;
    1308         if ( selectedObject == null ){
    1309             result = new Object[0];
    1310         }
    1311         else {
    1312             result = new Object[1];
    1313             result[0] = selectedObject;

    1314         }
    1315
    1316         return result;
    1317     }
    1318
    1319     /**
    1320      * This method is public as an implementation side effect.
    1321      * do not call or override.
    1322      */
    1323     @SuppressWarnings("unchecked")
    1324     public void actionPerformed(ActionEvent e) {
    1325         setPopupVisible(false);
    1326         getModel().setSelectedItem((E)getEditor().getItem());
    1327         String oldCommand = getActionCommand();
    1328         setActionCommand("comboBoxEdited");
    1329         fireActionEvent();
    1330         setActionCommand(oldCommand);
    1331     }
    1332
    1333     /**
    1334      * This method is public as an implementation side effect.
    1335      * do not call or override.
    1336      */
    1337     public void contentsChanged(ListDataEvent e) {
    1338         E oldSelection = selectedItemReminder;
    1339         E newSelection = dataModel.getSelectedItem();
    1340         if (oldSelection == null || !oldSelection.equals(newSelection)) {
    1341             selectedItemChanged();
    1342             if (!selectingItem) {
    1343                 fireActionEvent();
    1344             }
    1345         }
    1346     }
    1347
    1348     /**
    1349      * This method is public as an implementation side effect.
    1350      * do not call or override.
    1351      */
    1352     public void intervalAdded(ListDataEvent e) {
    1353         if (selectedItemReminder != dataModel.getSelectedItem()) {
    1354             selectedItemChanged();
    1355         }
    1356     }
    1357
    1358     /**
    1359      * This method is public as an implementation side effect.
    1933         /**
    1934          * Get the AccessibleSelection associated with this object.  In the
    1935          * implementation of the Java Accessibility API for this class,
    1936          * return this object, which is responsible for implementing the
    1937          * AccessibleSelection interface on behalf of itself.
    1938          *
    1939          * @return this object
    1940          */
    1941         public AccessibleSelection getAccessibleSelection() {
    1942             return this;
    1943         }
    1944
    1945         /**
    1946          * Returns the number of Accessible children currently selected.
    1947          * If no children are selected, the return value will be 0.
    1948          *
    1949          * @return the number of items currently selected.
    1950          * @since 1.3
    1951          */
    1952         public int getAccessibleSelectionCount() {
    1953             E o = JComboBox.this.getSelectedItem();
    1954             if (o != null) {
    1955                 return 1;
    1956             } else {
    1957                 return 0;
    1958             }
    1959         }
    1960
    1961         /**
    1962          * Returns an Accessible representing the specified selected child
    1963          * in the popup.  If there isn't a selection, or there are
    1964          * fewer children selected than the integer passed in, the return
    1965          * value will be null.
    1966          * <p>Note that the index represents the i-th selected child, which
    1967          * is different from the i-th child.
    1968          *
    1969          * @param i the zero-based index of selected children
    1970          * @return the i-th selected child
    1971          * @see #getAccessibleSelectionCount
    1972          * @since 1.3
    1973          */

< prev index next >