This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing
class DefaultComboBoxModel

java.lang.Object extended by javax.swing.AbstractListModel extended by javax.swing.DefaultComboBoxModel
All Implemented Interfaces:
Serializable, ListModel, MutableComboBoxModel

Most common way to construct:

DefaultComboBoxModel model = new DefaultComboBoxModel();

Based on 41 examples


public class DefaultComboBoxModel
extends AbstractListModel
implements MutableComboBoxModel, Serializable

The default model for combo boxes.


Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary

          Constructs an empty DefaultComboBoxModel object.

          Constructs a DefaultComboBoxModel object initialized with an array of objects.

          Constructs a DefaultComboBoxModel object initialized with a vector.
 
Method Summary
 void
addElement(Object anObject)

          
 Object
getElementAt(int index)

          
 int
getIndexOf(Object anObject)

          Returns the index-position of the specified object in the list.
 Object

          
 int

          
 void
insertElementAt(Object anObject, int index)

          
 void

          Empties the list.
 void

          
 void
removeElementAt(int index)

          
 void

          Set the value of the selected item.
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultComboBoxModel

public DefaultComboBoxModel()
Constructs an empty DefaultComboBoxModel object.


DefaultComboBoxModel

public DefaultComboBoxModel(Object[] items)
Constructs a DefaultComboBoxModel object initialized with an array of objects.

Parameters:
items - an array of Object objects

DefaultComboBoxModel

public DefaultComboBoxModel(Vector v)
Constructs a DefaultComboBoxModel object initialized with a vector.

Parameters:
v - a Vector object ...
Method Detail

addElement

public void addElement(Object anObject)
Parameters:
anObject

getElementAt

public Object getElementAt(int index)
Parameters:
index

getIndexOf

public int getIndexOf(Object anObject)
Returns the index-position of the specified object in the list.

Parameters:
anObject
Returns:
an int representing the index position, where 0 is the first position

getSelectedItem

public Object getSelectedItem()

getSize

public int getSize()

insertElementAt

public void insertElementAt(Object anObject,
                            int index)
Parameters:
anObject
index

removeAllElements

public void removeAllElements()
Empties the list.


removeElement

public void removeElement(Object anObject)
Parameters:
anObject

removeElementAt

public void removeElementAt(int index)
Parameters:
index

setSelectedItem

public void setSelectedItem(Object anObject)
Set the value of the selected item. The selected item may be null.

Parameters:
anObject - The combo box value or null for no selection.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.