E -这个模型的元素类型
public class DefaultComboBoxModel<E> extends AbstractListModel<E> implements MutableComboBoxModel<E>, Serializable
listenerList| Constructor and Description |
|---|
DefaultComboBoxModel()
构造一个空defaultcomboboxmodel对象。
|
DefaultComboBoxModel(E[] items)
构建了一个defaultcomboboxmodel对象与对象数组初始化。
|
DefaultComboBoxModel(Vector<E> v)
构建了一个defaultcomboboxmodel对象与载体初始化。
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(E anObject)
在模型的结尾添加一个项目。
|
E |
getElementAt(int index)
返回指定索引处的值。
|
int |
getIndexOf(Object anObject)
返回列表中指定对象的索引位置。
|
Object |
getSelectedItem()
返回选定的项目
|
int |
getSize()
返回列表的长度。
|
void |
insertElementAt(E anObject, int index)
在一个特定的索引中添加一个项目。
|
void |
removeAllElements()
清空列表。
|
void |
removeElement(Object anObject)
从模型中移除一个项目。
|
void |
removeElementAt(int index)
在一个特定的索引中删除一个项目。
|
void |
setSelectedItem(Object anObject)
设置选定项目的值。
|
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListDataListener, removeListDataListenerpublic DefaultComboBoxModel()
public DefaultComboBoxModel(E[] items)
items -数组对象的对象
public void setSelectedItem(Object anObject)
setSelectedItem 接口
ComboBoxModel<E>
anObject -组合框的值或空无的选择。
public Object getSelectedItem()
ComboBoxModel
getSelectedItem 接口
ComboBoxModel<E>
null如果没有选择
public int getSize()
ListModel
public E getElementAt(int index)
ListModel
getElementAt 接口
ListModel<E>
index -请求的索引
index价值
public int getIndexOf(Object anObject)
anObject—
public void addElement(E anObject)
MutableComboBoxModel
ListDataListeners,项目已添加。
addElement 接口
MutableComboBoxModel<E>
anObject -要添加的项目
public void insertElementAt(E anObject, int index)
MutableComboBoxModel
ListDataListeners,项目已添加。
insertElementAt 接口
MutableComboBoxModel<E>
anObject -要添加的项目
index位置添加对象
public void removeElementAt(int index)
MutableComboBoxModel
ListDataListeners该项已被删除。
removeElementAt 接口
MutableComboBoxModel<E>
index -位置
public void removeElement(Object anObject)
MutableComboBoxModel
ListDataListeners该项已被删除。
removeElement 接口
MutableComboBoxModel<E>
anObject -
Object被删除
public void removeAllElements()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.