|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JComboBox
public class JComboBox
将按钮或可编辑字段与下拉列表组合的组件。用户可以从下拉列表中选择值,下拉列表在用户请求时显示。如果使组合框处于可编辑状态,则组合框将包括用户可在其中键入值的可编辑字段。
有关标准外观 (L&F) 处理中此组件使用的键盘键,请参阅 JComboBox key assignments。
警告:此类的序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储,或适用于在运行相同 Swing 版本的应用程序之间进行 RMI(Remote Method Invocation,远程方法调用)。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder。
有关更多信息,请参阅《The Java Tutorial》中的 How to Use Combo Boxes 一节。
| 嵌套类摘要 | |
|---|---|
protected class |
JComboBox.AccessibleJComboBox
此类实现 JComboBox 类的可访问性支持。 |
static interface |
JComboBox.KeySelectionManager
定义 KeySelectionManager 的接口。 |
| 从类 javax.swing.JComponent 继承的嵌套类/接口 |
|---|
JComponent.AccessibleJComponent |
| 从类 java.awt.Container 继承的嵌套类/接口 |
|---|
Container.AccessibleAWTContainer |
| 从类 java.awt.Component 继承的嵌套类/接口 |
|---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| 字段摘要 | |
|---|---|
protected String |
actionCommand
此受保护字段是特定于实现的。 |
protected ComboBoxModel |
dataModel
此受保护字段是特定于实现的。 |
protected ComboBoxEditor |
editor
此受保护字段是特定于实现的。 |
protected boolean |
isEditable
此受保护字段是特定于实现的。 |
protected JComboBox.KeySelectionManager |
keySelectionManager
此受保护字段是特定于实现的。 |
protected boolean |
lightWeightPopupEnabled
此受保护字段是特定于实现的。 |
protected int |
maximumRowCount
此受保护字段是特定于实现的。 |
protected ListCellRenderer |
renderer
此受保护字段是特定于实现的。 |
protected Object |
selectedItemReminder
此受保护字段是特定于实现的。 |
| 从类 javax.swing.JComponent 继承的字段 |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| 从类 java.awt.Component 继承的字段 |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| 从接口 java.awt.image.ImageObserver 继承的字段 |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| 构造方法摘要 | |
|---|---|
JComboBox()
创建具有默认数据模型的 JComboBox。 |
|
JComboBox(ComboBoxModel aModel)
创建一个 JComboBox,其项取自现有的 ComboBoxModel 中。 |
|
JComboBox(Object[] items)
创建包含指定数组中的元素的 JComboBox。 |
|
JComboBox(Vector<?> items)
创建包含指定 Vector 中的元素的 JComboBox。 |
|
| 方法摘要 | |
|---|---|
void |
actionPerformed(ActionEvent e)
此方法作为实现的副作用存在的公共方法。 |
void |
addActionListener(ActionListener l)
添加 ActionListener。 |
void |
addItem(Object anObject)
为项列表添加项。 |
void |
addItemListener(ItemListener aListener)
添加 ItemListener。 |
void |
addPopupMenuListener(PopupMenuListener l)
添加 PopupMenu 侦听器,该侦听器将侦听来自组合框弹出部分的通知消息。 |
void |
configureEditor(ComboBoxEditor anEditor,
Object anItem)
利用指定项初始化编辑器。 |
protected void |
configurePropertiesFromAction(Action a)
该工厂方法根据 Action 实例的值设置 ActionEvent 源的属性。 |
void |
contentsChanged(ListDataEvent e)
此方法作为实现的副作用存在的公共方法。 |
protected PropertyChangeListener |
createActionPropertyChangeListener(Action a)
该工厂方法创建 PropertyChangeListener,用来在 Action 实例上的属性更改时更新 ActionEvent 源。 |
protected JComboBox.KeySelectionManager |
createDefaultKeySelectionManager()
返回默认键选择管理器的实例。 |
protected void |
fireActionEvent()
通知所有对此事件类型的通知感兴趣的已注册侦听器。 |
protected void |
fireItemStateChanged(ItemEvent e)
通知所有对此事件类型的通知感兴趣的已注册侦听器。 |
void |
firePopupMenuCanceled()
通知 PopupMenuListener 组合框的弹出部分已被取消。 |
void |
firePopupMenuWillBecomeInvisible()
通知 PopupMenuListener 组合框的弹出部分已变得不可见。 |
void |
firePopupMenuWillBecomeVisible()
通知 PopupMenuListener 组合框的弹出部分将变得可见。 |
AccessibleContext |
getAccessibleContext()
获得与此 JComboBox 关联的 AccessibleContext。 |
Action |
getAction()
返回此 ActionEvent 源当前设置的 Action,如果没有设置任何 Action,则返回 null。 |
String |
getActionCommand()
返回发送到动作侦听器的事件中包括的动作命令。 |
ActionListener[] |
getActionListeners()
返回使用 addActionListener() 添加到此 JComboBox 的所有 ActionListener 组成的数组。 |
ComboBoxEditor |
getEditor()
返回用于绘制和编辑 JComboBox 字段中所选项的编辑器。 |
Object |
getItemAt(int index)
返回指定索引处的列表项。 |
int |
getItemCount()
返回列表中的项数。 |
ItemListener[] |
getItemListeners()
返回使用 addItemListener() 添加到此 JComboBox 中的所有 ItemListener 组成的数组。 |
JComboBox.KeySelectionManager |
getKeySelectionManager()
返回列表的键选择管理器。 |
int |
getMaximumRowCount()
返回组合框不使用滚动条可以显示的最大项数 |
ComboBoxModel |
getModel()
返回 JComboBox 当前使用的数据模型。 |
PopupMenuListener[] |
getPopupMenuListeners()
返回利用 addPopupMenuListener() 添加到此 JComboBox 的所有 PopupMenuListener 组成的数组。 |
Object |
getPrototypeDisplayValue()
返回“原型显示”值,即用于计算显示高度和宽度的 Object。 |
ListCellRenderer |
getRenderer()
返回用于显示 JComboBox 字段中所选项的渲染器。 |
int |
getSelectedIndex()
返回列表中与给定项匹配的第一个选项。 |
Object |
getSelectedItem()
返回当前所选项。 |
Object[] |
getSelectedObjects()
返回包含所选项的数组。 |
ComboBoxUI |
getUI()
返回呈现此组件的 L&F 对象。 |
String |
getUIClassID()
返回呈现此组件的 L&F 类的名称。 |
void |
hidePopup()
促使组合框关闭其弹出窗口。 |
void |
insertItemAt(Object anObject,
int index)
在项列表中的给定索引处插入项。 |
protected void |
installAncestorListener()
|
void |
intervalAdded(ListDataEvent e)
此方法作为实现的副作用存在的公共方法。 |
void |
intervalRemoved(ListDataEvent e)
此方法作为实现的副作用存在的公共方法。 |
boolean |
isEditable()
如果 JComboBox 可编辑,则返回 true。 |
boolean |
isLightWeightPopupEnabled()
获取 lightWeightPopupEnabled 属性的值。 |
boolean |
isPopupVisible()
确定弹出窗口的可见性。 |
protected String |
paramString()
返回此 JComboBox 的字符串表示形式。 |
void |
processKeyEvent(KeyEvent e)
处理 KeyEvent,查找 Tab 键。 |
void |
removeActionListener(ActionListener l)
移除 ActionListener。 |
void |
removeAllItems()
从项列表中移除所有项。 |
void |
removeItem(Object anObject)
从项列表中移除项。 |
void |
removeItemAt(int anIndex)
移除 anIndex 处的项。 |
void |
removeItemListener(ItemListener aListener)
移除 ItemListener。 |
void |
removePopupMenuListener(PopupMenuListener l)
移除 PopupMenuListener。 |
protected void |
selectedItemChanged()
此受保护方法是特定于实现的。 |
boolean |
selectWithKeyChar(char keyChar)
如果存在与指定键盘字符相对应的项,则选择该列表项并返回 true。 |
void |
setAction(Action a)
设置 ActionEvent 源的 Action。 |
void |
setActionCommand(String aCommand)
设置发送到动作侦听器的事件中应该包括的动作命令。 |
void |
setEditable(boolean aFlag)
确定 JComboBox 字段是否可编辑。 |
void |
setEditor(ComboBoxEditor anEditor)
设置用于绘制和编辑 JComboBox 字段中所选项的编辑器。 |
void |
setEnabled(boolean b)
启用组合框以便可以选择项。 |
void |
setKeySelectionManager(JComboBox.KeySelectionManager aManager)
设置将键盘字符转换为列表选择的对象。 |
void |
setLightWeightPopupEnabled(boolean aFlag)
设置 lightWeightPopupEnabled 属性,该属性提供一个提示:是应该使用重量级 Component(如 Panel 或 Window)还是轻量级 Component 来包含 JComboBox。 |
void |
setMaximumRowCount(int count)
设置 JComboBox 显示的最大行数。 |
void |
setModel(ComboBoxModel aModel)
设置 JComboBox 用于获取项列表的数据模型。 |
void |
setPopupVisible(boolean v)
设置弹出窗口的可见性。 |
void |
setPrototypeDisplayValue(Object prototypeDisplayValue)
设置用于计算 UI 部分的显示大小的原型显示值。 |
void |
setRenderer(ListCellRenderer aRenderer)
设置渲染器,该渲染器用于绘制列表项和从 JComboBox 字段的列表中选择的项。 |
void |
setSelectedIndex(int anIndex)
选择索引 anIndex 处的项。 |
void |
setSelectedItem(Object anObject)
将组合框显示区域中所选项设置为参数中的对象。 |
void |
setUI(ComboBoxUI ui)
设置呈现此组件的 L&F 对象。 |
void |
showPopup()
促使组合框显示其弹出窗口。 |
void |
updateUI()
将 UI 属性重置为当前外观的值。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
protected ComboBoxModel dataModel
protected ListCellRenderer renderer
protected ComboBoxEditor editor
protected int maximumRowCount
protected boolean isEditable
protected JComboBox.KeySelectionManager keySelectionManager
protected String actionCommand
protected boolean lightWeightPopupEnabled
protected Object selectedItemReminder
| 构造方法详细信息 |
|---|
public JComboBox(ComboBoxModel aModel)
JComboBox,其项取自现有的 ComboBoxModel 中。由于提供了 ComboBoxModel,使用此构造方法创建的组合框不创建默认组合框模型,这可能对插入、移除和添加方法的行为都有影响。
aModel - 提供显示的项列表的 ComboBoxModelDefaultComboBoxModelpublic JComboBox(Object[] items)
JComboBox。默认情况下,选择数组中的第一项(因而也选择了该项的数据模型)。
items - 要插入到组合框的对象数组DefaultComboBoxModelpublic JComboBox(Vector<?> items)
JComboBox。默认情况下,选择数组中的第一项(因而也选择了该项的数据模型)。
items - 要插入到组合框的向量数组DefaultComboBoxModelpublic JComboBox()
JComboBox。默认的数据模型为空对象列表。使用 addItem 添加项。默认情况下选择数据模型中的第一项。
DefaultComboBoxModel| 方法详细信息 |
|---|
protected void installAncestorListener()
public void setUI(ComboBoxUI ui)
ui - ComboBoxUI L&F 对象UIDefaults.getUI(javax.swing.JComponent)public void updateUI()
JComponent 中的 updateUIpublic String getUIClassID()
JComponent 中的 getUIClassIDJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)public ComboBoxUI getUI()
public void setModel(ComboBoxModel aModel)
JComboBox 用于获取项列表的数据模型。
aModel - 提供显示的项列表的 ComboBoxModelpublic ComboBoxModel getModel()
JComboBox 当前使用的数据模型。
ComboBoxModelpublic void setLightWeightPopupEnabled(boolean aFlag)
lightWeightPopupEnabled 属性,该属性提供一个提示:是应该使用重量级 Component(如 Panel 或 Window)还是轻量级 Component 来包含 JComboBox。使用轻量级还是重量级组件,最终由 JComboBox 决定。轻量级窗口比重量级窗口更有效,但是轻量级和重量级组件在 GUI 中不能很好地混合使用。如果应用程序混合使用轻量级和重量级组件,则应该禁用轻量级弹出窗口。除非由外观另行指定,否则 lightWeightPopupEnabled 属性的默认值为 true。某些外观始终使用重量级弹出窗口,不管此属性的值如何。
请参阅 The Swing Connection 上的文章 Mixing Heavy and Light Components。此方法激发属性更改事件。
aFlag - 如果为 true,则需要轻量级弹出窗口public boolean isLightWeightPopupEnabled()
lightWeightPopupEnabled 属性的值。
lightWeightPopupEnabled 属性的值setLightWeightPopupEnabled(boolean)public void setEditable(boolean aFlag)
JComboBox 字段是否可编辑。可编辑的 JComboBox 允许用户在字段中键入内容或者从列表中选择项来初始化字段,执行此操作后,该字段就可编辑了。(编辑仅影响字段,列表项保持原样。)不可编辑的 JComboBox 在字段中显示所选项,但不能修改该选择。
aFlag - 布尔值,其中 true 指示字段可编辑。public boolean isEditable()
JComboBox 可编辑,则返回 true。默认情况下,组合框不可编辑。
JComboBox 可编辑,则返回 true;否则返回 falsepublic void setMaximumRowCount(int count)
JComboBox 显示的最大行数。如果模型中的对象数大于 count,则组合框使用滚动条。
count - 一个整数,它指定使用滚动条前要在列表中显示的最大项数public int getMaximumRowCount()
public void setRenderer(ListCellRenderer aRenderer)
默认渲染器显示字符串或图标。其他渲染器可处理图形图像和复合选项。
要显示所选项,请调用 aRenderer.getListCellRendererComponent,其中传递列表对象和索引 -1。
aRenderer - 显示所选项的 ListCellRenderersetEditor(javax.swing.ComboBoxEditor)public ListCellRenderer getRenderer()
JComboBox 字段中所选项的渲染器。
ListCellRenderer。public void setEditor(ComboBoxEditor anEditor)
JComboBox 字段中所选项的编辑器。仅当接收的 JComboBox 可编辑时才使用编辑器。如果不可编辑,则组合框使用渲染器绘制所选项。
anEditor - 显示所选项的 ComboBoxEditorsetRenderer(javax.swing.ListCellRenderer)public ComboBoxEditor getEditor()
JComboBox 字段中所选项的编辑器。
ComboBoxEditor。public void setSelectedItem(Object anObject)
anObject 在列表中,则显示区域显示所选的 anObject。
如果 anObject 不 在列表中,且组合框不可编辑,则不会更改显示区域中的当前选择。对于可编辑的组合框,选择将更改为 anObject。
如果此操作造成所选项中发生更改,则添加到组合框的 ItemListener 将获得一个或两个 ItemEvent 通知。如果有当前所选项,则将激发 ItemEvent,而状态更改将为 ItemEvent.DESELECTED。如果 anObject 在列表中,但不是当前选择的项,则将激发 ItemEvent,而状态更改将为 ItemEvent.SELECTED。
调用此方法时,添加到组合框的 ActionListener 将获得 ActionEvent 通知。
anObject - 要选择的列表对象;使用 null 清除选择public Object getSelectedItem()
如果组合框可编辑,则可能尚未使用 addItem、insertItemAt 或数据构造方法将此值添加到组合框中。
setSelectedItem(java.lang.Object)public void setSelectedIndex(int anIndex)
anIndex 处的项。
anIndex - 指定要选择的列表项的整数,其中 0 指定列表中的第一项,-1 指示没有作出选择
IllegalArgumentException - 如果 anIndex < -1 或者 anIndex 大于或等于列表大小public int getSelectedIndex()
JComboBox 允许选择不在列表中的项,则结果未必是明确的。如果不存在所选项或者用户指定的项不在列表中,则返回 -1。
public Object getPrototypeDisplayValue()
prototypeDisplayValue 属性的值setPrototypeDisplayValue(java.lang.Object)public void setPrototypeDisplayValue(Object prototypeDisplayValue)
如果指定了原型显示值,则组合框首选大小的计算方式是:利用原型显示值配置渲染器,然后获取其首选大小。指定首选显示值在组合框将显示大量数据时往往很有用。如果没有指定原型显示值,则必须为模型中的每个值及其获取的首选大小配置渲染器,其花费相对昂贵。
prototypeDisplayValue - getPrototypeDisplayValue()public void addItem(Object anObject)
JComboBox 使用可变数据模型时此方法才有效。
警告:如果添加复制的 String 对象,可能会发生焦点和键盘导航问题。解决方法是,添加新对象代替 String 对象,并且确保定义了 toString() 方法。例如:
comboBox.addItem(makeObj("Item 1"));
comboBox.addItem(makeObj("Item 1"));
...
private Object makeObj(final String item) {
return new Object() { public String toString() { return item; } };
}
anObject - 要添加到列表的 ObjectMutableComboBoxModelpublic void insertItemAt(Object anObject, int index)
JComboBox 使用可变数据模型时此方法才有效。
anObject - 要添加到列表的 Objectindex - 指定添加项的位置的整数MutableComboBoxModelpublic void removeItem(Object anObject)
JComboBox 使用可变数据模型时此方法才有效。
anObject - 要从项列表中移除的对象MutableComboBoxModelpublic void removeItemAt(int anIndex)
anIndex 处的项。仅当 JComboBox 使用可变数据模型时此方法才有效。
anIndex - 指定要移除的项索引的 int,其中 0 指示列表中的第一项MutableComboBoxModelpublic void removeAllItems()
public void showPopup()
public void hidePopup()
public void setPopupVisible(boolean v)
public boolean isPopupVisible()
public void addItemListener(ItemListener aListener)
ItemListener。
当所选项更改时,aListener 将接收一个或两个 ItemEvent。
ItemSelectable 中的 addItemListeneraListener - 要通知的 ItemListenersetSelectedItem(java.lang.Object)public void removeItemListener(ItemListener aListener)
ItemListener。
ItemSelectable 中的 removeItemListeneraListener - 要移除的 ItemListenerItemEventpublic ItemListener[] getItemListeners()
ItemListener 组成的数组。
ItemListener,如果没有添加侦听器,则返回一个空数组public void addActionListener(ActionListener l)
ActionListener。
当作出选择时,ActionListener 将接收一个 ActionEvent。如果组合框可编辑,则在编辑停止时将激发 ActionEvent。
l - 要通知的 ActionListenersetSelectedItem(java.lang.Object)public void removeActionListener(ActionListener l)
ActionListener。
l - 要移除的 ActionListenerpublic ActionListener[] getActionListeners()
ActionListener 组成的数组。
ActionListener;如果没有添加侦听器,则返回一个空数组public void addPopupMenuListener(PopupMenuListener l)
PopupMenu 侦听器,该侦听器将侦听来自组合框弹出部分的通知消息。
对于 Java 2 附带的所有标准外观,组合框的弹出列表部分将被实现为 JPopupMenu。自定义外观可能不以这种方式实现组合框的弹出列表部分,因此不接收通知。
l - 要添加的 PopupMenuListenerpublic void removePopupMenuListener(PopupMenuListener l)
PopupMenuListener。
l - 要移除的 PopupMenuListeneraddPopupMenuListener(javax.swing.event.PopupMenuListener)public PopupMenuListener[] getPopupMenuListeners()
PopupMenuListener 组成的数组。
PopupMenuListener,如果没有添加侦听器,则返回一个空数组public void firePopupMenuWillBecomeVisible()
PopupMenuListener 组合框的弹出部分将变得可见。
此方法是公共方法,但只能由 UI 代理调用。
addPopupMenuListener(javax.swing.event.PopupMenuListener)public void firePopupMenuWillBecomeInvisible()
PopupMenuListener 组合框的弹出部分已变得不可见。
此方法是公共方法,但只有 UI 委托才应调用。
addPopupMenuListener(javax.swing.event.PopupMenuListener)public void firePopupMenuCanceled()
PopupMenuListener 组合框的弹出部分已被取消。
此方法是公共方法,但只有 UI 委托才应调用。
addPopupMenuListener(javax.swing.event.PopupMenuListener)public void setActionCommand(String aCommand)
aCommand - 包含发送到动作侦听器的“命令”的字符串;根据其所接受的命令,相同的侦听器可以做不同的事情public String getActionCommand()
public void setAction(Action a)
ActionEvent 源的 Action。新的 Action 替换任何以前设置的 Action,而不影响通过 addActionListener 独立添加的 ActionListener。如果 Action 已经是一个注册到 ActionEvent 源的 ActionListener,则不对它进行重新注册。
设置 Action 的一个副作用是 ActionEvent 源的属性立即被设置为 Action 中的值(由 configurePropertiesFromAction 方法执行),并且随着 Action 的属性的变化而更新(通过 createActionPropertyChangeListener 方法创建的 PropertyChangeListener 完成)。
a - JComboBox 的 Action,或者为 null。Action,
getAction(),
configurePropertiesFromAction(javax.swing.Action),
createActionPropertyChangeListener(javax.swing.Action)public Action getAction()
ActionEvent 源当前设置的 Action,如果没有设置任何 Action,则返回 null。
ActionEvent 源的 Action;或者 nullAction,
setAction(javax.swing.Action)protected void configurePropertiesFromAction(Action a)
Action 实例的值设置 ActionEvent 源的属性。所设置的属性可能随着子类的不同而不同。默认情况下,对属性 Enabled 和 ToolTipText 进行设置。
a - 从其获取属性的 Action,或者为 nullAction,
setAction(javax.swing.Action)protected PropertyChangeListener createActionPropertyChangeListener(Action a)
PropertyChangeListener,用来在 Action 实例上的属性更改时更新 ActionEvent 源。如果需要更新的属性集合与默认属性(Text、Icon、Enabled、ToolTipText)不同,则子类可以重写它,以便提供它们自己的 PropertyChangeListener。
注意,PropertyChangeListeners 应避免对 ActionEvent 源的强引用,因为这会妨碍 ActionEvent 源及其容器层次结构中的所有组件的垃圾回收。
Action,
setAction(javax.swing.Action)protected void fireItemStateChanged(ItemEvent e)
e - 感兴趣的事件EventListenerListprotected void fireActionEvent()
EventListenerListprotected void selectedItemChanged()
public Object[] getSelectedObjects()
ItemSelectable 兼容。
ItemSelectable 中的 getSelectedObjectsObject 数组public void actionPerformed(ActionEvent e)
ActionListener 中的 actionPerformedpublic void contentsChanged(ListDataEvent e)
ListDataListener 中的 contentsChangede - 封装事件信息的 ListDataEventpublic void intervalAdded(ListDataEvent e)
ListDataListener 中的 intervalAddede - 封装事件信息的 ListDataEventpublic void intervalRemoved(ListDataEvent e)
ListDataListener 中的 intervalRemovede - 封装事件信息的 ListDataEventpublic boolean selectWithKeyChar(char keyChar)
keyChar - 一个 char,它通常是用户键入的键盘键public void setEnabled(boolean b)
JComponent 中的 setEnabledb - 一个 boolean 值,它为 true 时,启用该组件,它为 false 时,禁用该组件Component.isEnabled(),
Component.isLightweight()public void configureEditor(ComboBoxEditor anEditor, Object anItem)
anEditor - 显示组合框字段中的列表项,并可以对其进行编辑的 ComboBoxEditoranItem - 要在字段中显示和编辑的对象public void processKeyEvent(KeyEvent e)
KeyEvent,查找 Tab 键。如果找不到 Tab 键,则关闭弹出窗口。
JComponent 中的 processKeyEventpublic void setKeySelectionManager(JComboBox.KeySelectionManager aManager)
public JComboBox.KeySelectionManager getKeySelectionManager()
KeySelectionManagerpublic int getItemCount()
public Object getItemAt(int index)
index 超出范围(小于零或者大于或等于列表大小),则其返回 null。
index - 指示列表位置的整数,其中第一项从零开始
Object;如果超出范围,则返回 nullprotected JComboBox.KeySelectionManager createDefaultKeySelectionManager()
KeySelectionManagersetKeySelectionManager(javax.swing.JComboBox.KeySelectionManager)protected String paramString()
JComboBox 的字符串表示形式。此方法仅在进行调试的时候使用,对于各个实现,所返回字符串的内容和格式可能有所不同。返回的字符串可能为空,但不可能为 null。
JComponent 中的 paramStringJComboBox 的字符串表示形式public AccessibleContext getAccessibleContext()
Accessible 中的 getAccessibleContextJComponent 中的 getAccessibleContext
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。