equal
deleted
inserted
replaced
113 * |
113 * |
114 * @serial |
114 * @serial |
115 * @see #addItem(String) |
115 * @see #addItem(String) |
116 * @see #getItem(int) |
116 * @see #getItem(int) |
117 */ |
117 */ |
118 Vector items = new Vector(); |
118 Vector<String> items = new Vector<>(); |
119 |
119 |
120 /** |
120 /** |
121 * This field will represent the number of visible rows in the |
121 * This field will represent the number of visible rows in the |
122 * <code>List</code> Component. It is specified only once, and |
122 * <code>List</code> Component. It is specified only once, and |
123 * that is when the list component is actually |
123 * that is when the list component is actually |
304 // NOTE: This method may be called by privileged threads. |
304 // NOTE: This method may be called by privileged threads. |
305 // We implement this functionality in a package-private method |
305 // We implement this functionality in a package-private method |
306 // to insure that it cannot be overridden by client subclasses. |
306 // to insure that it cannot be overridden by client subclasses. |
307 // DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
307 // DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
308 final String getItemImpl(int index) { |
308 final String getItemImpl(int index) { |
309 return (String)items.elementAt(index); |
309 return items.elementAt(index); |
310 } |
310 } |
311 |
311 |
312 /** |
312 /** |
313 * Gets the items in the list. |
313 * Gets the items in the list. |
314 * @return a string array containing items of the list |
314 * @return a string array containing items of the list |
413 public synchronized void clear() { |
413 public synchronized void clear() { |
414 ListPeer peer = (ListPeer)this.peer; |
414 ListPeer peer = (ListPeer)this.peer; |
415 if (peer != null) { |
415 if (peer != null) { |
416 peer.removeAll(); |
416 peer.removeAll(); |
417 } |
417 } |
418 items = new Vector(); |
418 items = new Vector<>(); |
419 selected = new int[0]; |
419 selected = new int[0]; |
420 } |
420 } |
421 |
421 |
422 /** |
422 /** |
423 * Removes the first occurrence of an item from the list. |
423 * Removes the first occurrence of an item from the list. |
488 * @see #isIndexSelected |
488 * @see #isIndexSelected |
489 */ |
489 */ |
490 public synchronized int[] getSelectedIndexes() { |
490 public synchronized int[] getSelectedIndexes() { |
491 ListPeer peer = (ListPeer)this.peer; |
491 ListPeer peer = (ListPeer)this.peer; |
492 if (peer != null) { |
492 if (peer != null) { |
493 selected = ((ListPeer)peer).getSelectedIndexes(); |
493 selected = peer.getSelectedIndexes(); |
494 } |
494 } |
495 return (int[])selected.clone(); |
495 return selected.clone(); |
496 } |
496 } |
497 |
497 |
498 /** |
498 /** |
499 * Gets the selected item on this scrolling list. |
499 * Gets the selected item on this scrolling list. |
500 * |
500 * |
906 * @see java.awt.event.ItemEvent |
906 * @see java.awt.event.ItemEvent |
907 * @see java.awt.event.ItemListener |
907 * @see java.awt.event.ItemListener |
908 * @since 1.4 |
908 * @since 1.4 |
909 */ |
909 */ |
910 public synchronized ItemListener[] getItemListeners() { |
910 public synchronized ItemListener[] getItemListeners() { |
911 return (ItemListener[])(getListeners(ItemListener.class)); |
911 return getListeners(ItemListener.class); |
912 } |
912 } |
913 |
913 |
914 /** |
914 /** |
915 * Adds the specified action listener to receive action events from |
915 * Adds the specified action listener to receive action events from |
916 * this list. Action events occur when a user double-clicks |
916 * this list. Action events occur when a user double-clicks |
973 * @see java.awt.event.ActionEvent |
973 * @see java.awt.event.ActionEvent |
974 * @see java.awt.event.ActionListener |
974 * @see java.awt.event.ActionListener |
975 * @since 1.4 |
975 * @since 1.4 |
976 */ |
976 */ |
977 public synchronized ActionListener[] getActionListeners() { |
977 public synchronized ActionListener[] getActionListeners() { |
978 return (ActionListener[])(getListeners(ActionListener.class)); |
978 return getListeners(ActionListener.class); |
979 } |
979 } |
980 |
980 |
981 /** |
981 /** |
982 * Returns an array of all the objects currently registered |
982 * Returns an array of all the objects currently registered |
983 * as <code><em>Foo</em>Listener</code>s |
983 * as <code><em>Foo</em>Listener</code>s |