38 * @since 1.2
39 */
40 @SuppressWarnings("serial") // Superclass is not serializable across versions
41 public class DefaultComboBoxModel<E> extends AbstractListModel<E> implements MutableComboBoxModel<E>, Serializable {
42 Vector<E> objects;
43 Object selectedObject;
44
45 /**
46 * Constructs an empty DefaultComboBoxModel object.
47 */
48 public DefaultComboBoxModel() {
49 objects = new Vector<E>();
50 }
51
52 /**
53 * Constructs a DefaultComboBoxModel object initialized with
54 * an array of objects.
55 *
56 * @param items an array of Object objects
57 */
58 public DefaultComboBoxModel(final E items[]) {
59 objects = new Vector<E>(items.length);
60
61 int i,c;
62 for ( i=0,c=items.length;i<c;i++ )
63 objects.addElement(items[i]);
64
65 if ( getSize() > 0 ) {
66 selectedObject = getElementAt( 0 );
67 }
68 }
69
70 /**
71 * Constructs a DefaultComboBoxModel object initialized with
72 * a vector.
73 *
74 * @param v a Vector object ...
75 */
76 public DefaultComboBoxModel(Vector<E> v) {
77 objects = v;
78
|
38 * @since 1.2
39 */
40 @SuppressWarnings("serial") // Superclass is not serializable across versions
41 public class DefaultComboBoxModel<E> extends AbstractListModel<E> implements MutableComboBoxModel<E>, Serializable {
42 Vector<E> objects;
43 Object selectedObject;
44
45 /**
46 * Constructs an empty DefaultComboBoxModel object.
47 */
48 public DefaultComboBoxModel() {
49 objects = new Vector<E>();
50 }
51
52 /**
53 * Constructs a DefaultComboBoxModel object initialized with
54 * an array of objects.
55 *
56 * @param items an array of Object objects
57 */
58 public DefaultComboBoxModel(final E[] items) {
59 objects = new Vector<E>(items.length);
60
61 int i,c;
62 for ( i=0,c=items.length;i<c;i++ )
63 objects.addElement(items[i]);
64
65 if ( getSize() > 0 ) {
66 selectedObject = getElementAt( 0 );
67 }
68 }
69
70 /**
71 * Constructs a DefaultComboBoxModel object initialized with
72 * a vector.
73 *
74 * @param v a Vector object ...
75 */
76 public DefaultComboBoxModel(Vector<E> v) {
77 objects = v;
78
|