JComboBox (Java Platform SE 8 ) (original) (raw)

Modifier and Type

Method

Description

void

[actionPerformed](../../javax/swing/JComboBox.html#actionPerformed-java.awt.event.ActionEvent-)([ActionEvent](../../java/awt/event/ActionEvent.html "class in java.awt.event") e)

This method is public as an implementation side effect.

protected void

[actionPropertyChanged](../../javax/swing/JComboBox.html#actionPropertyChanged-javax.swing.Action-java.lang.String-)([Action](../../javax/swing/Action.html "interface in javax.swing") action,[String](../../java/lang/String.html "class in java.lang") propertyName)

Updates the combobox's state in response to property changes in associated action.

void

[addActionListener](../../javax/swing/JComboBox.html#addActionListener-java.awt.event.ActionListener-)([ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event") l)

Adds an ActionListener.

void

[addItem](../../javax/swing/JComboBox.html#addItem-E-)([E](../../javax/swing/JComboBox.html "type parameter in JComboBox") item)

Adds an item to the item list.

void

[addItemListener](../../javax/swing/JComboBox.html#addItemListener-java.awt.event.ItemListener-)([ItemListener](../../java/awt/event/ItemListener.html "interface in java.awt.event") aListener)

Adds an ItemListener.

void

[addPopupMenuListener](../../javax/swing/JComboBox.html#addPopupMenuListener-javax.swing.event.PopupMenuListener-)([PopupMenuListener](../../javax/swing/event/PopupMenuListener.html "interface in javax.swing.event") l)

Adds a PopupMenu listener which will listen to notification messages from the popup portion of the combo box.

void

[configureEditor](../../javax/swing/JComboBox.html#configureEditor-javax.swing.ComboBoxEditor-java.lang.Object-)([ComboBoxEditor](../../javax/swing/ComboBoxEditor.html "interface in javax.swing") anEditor,[Object](../../java/lang/Object.html "class in java.lang") anItem)

Initializes the editor with the specified item.

protected void

[configurePropertiesFromAction](../../javax/swing/JComboBox.html#configurePropertiesFromAction-javax.swing.Action-)([Action](../../javax/swing/Action.html "interface in javax.swing") a)

Sets the properties on this combobox to match those in the specifiedAction.

void

[contentsChanged](../../javax/swing/JComboBox.html#contentsChanged-javax.swing.event.ListDataEvent-)([ListDataEvent](../../javax/swing/event/ListDataEvent.html "class in javax.swing.event") e)

This method is public as an implementation side effect.

protected [PropertyChangeListener](../../java/beans/PropertyChangeListener.html "interface in java.beans")

[createActionPropertyChangeListener](../../javax/swing/JComboBox.html#createActionPropertyChangeListener-javax.swing.Action-)([Action](../../javax/swing/Action.html "interface in javax.swing") a)

Creates and returns a PropertyChangeListener that is responsible for listening for changes from the specifiedAction and updating the appropriate properties.

protected [JComboBox.KeySelectionManager](../../javax/swing/JComboBox.KeySelectionManager.html "interface in javax.swing")

[createDefaultKeySelectionManager](../../javax/swing/JComboBox.html#createDefaultKeySelectionManager--)()

Returns an instance of the default key-selection manager.

protected void

[fireActionEvent](../../javax/swing/JComboBox.html#fireActionEvent--)()

Notifies all listeners that have registered interest for notification on this event type.

protected void

[fireItemStateChanged](../../javax/swing/JComboBox.html#fireItemStateChanged-java.awt.event.ItemEvent-)([ItemEvent](../../java/awt/event/ItemEvent.html "class in java.awt.event") e)

Notifies all listeners that have registered interest for notification on this event type.

void

[firePopupMenuCanceled](../../javax/swing/JComboBox.html#firePopupMenuCanceled--)()

Notifies PopupMenuListeners that the popup portion of the combo box has been canceled.

void

[firePopupMenuWillBecomeInvisible](../../javax/swing/JComboBox.html#firePopupMenuWillBecomeInvisible--)()

Notifies PopupMenuListeners that the popup portion of the combo box has become invisible.

void

[firePopupMenuWillBecomeVisible](../../javax/swing/JComboBox.html#firePopupMenuWillBecomeVisible--)()

Notifies PopupMenuListeners that the popup portion of the combo box will become visible.

[AccessibleContext](../../javax/accessibility/AccessibleContext.html "class in javax.accessibility")

[getAccessibleContext](../../javax/swing/JComboBox.html#getAccessibleContext--)()

Gets the AccessibleContext associated with this JComboBox.

[Action](../../javax/swing/Action.html "interface in javax.swing")

[getAction](../../javax/swing/JComboBox.html#getAction--)()

Returns the currently set Action for thisActionEvent source, or null if noAction is set.

[String](../../java/lang/String.html "class in java.lang")

[getActionCommand](../../javax/swing/JComboBox.html#getActionCommand--)()

Returns the action command that is included in the event sent to action listeners.

[ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event")[]

[getActionListeners](../../javax/swing/JComboBox.html#getActionListeners--)()

Returns an array of all the ActionListeners added to this JComboBox with addActionListener().

[ComboBoxEditor](../../javax/swing/ComboBoxEditor.html "interface in javax.swing")

[getEditor](../../javax/swing/JComboBox.html#getEditor--)()

Returns the editor used to paint and edit the selected item in theJComboBox field.

[E](../../javax/swing/JComboBox.html "type parameter in JComboBox")

[getItemAt](../../javax/swing/JComboBox.html#getItemAt-int-)(int index)

Returns the list item at the specified index.

int

[getItemCount](../../javax/swing/JComboBox.html#getItemCount--)()

Returns the number of items in the list.

[ItemListener](../../java/awt/event/ItemListener.html "interface in java.awt.event")[]

[getItemListeners](../../javax/swing/JComboBox.html#getItemListeners--)()

Returns an array of all the ItemListeners added to this JComboBox with addItemListener().

[JComboBox.KeySelectionManager](../../javax/swing/JComboBox.KeySelectionManager.html "interface in javax.swing")

[getKeySelectionManager](../../javax/swing/JComboBox.html#getKeySelectionManager--)()

Returns the list's key-selection manager.

int

[getMaximumRowCount](../../javax/swing/JComboBox.html#getMaximumRowCount--)()

Returns the maximum number of items the combo box can display without a scrollbar

[ComboBoxModel](../../javax/swing/ComboBoxModel.html "interface in javax.swing")<[E](../../javax/swing/JComboBox.html "type parameter in JComboBox")>

[getModel](../../javax/swing/JComboBox.html#getModel--)()

Returns the data model currently used by the JComboBox.

[PopupMenuListener](../../javax/swing/event/PopupMenuListener.html "interface in javax.swing.event")[]

[getPopupMenuListeners](../../javax/swing/JComboBox.html#getPopupMenuListeners--)()

Returns an array of all the PopupMenuListeners added to this JComboBox with addPopupMenuListener().

[E](../../javax/swing/JComboBox.html "type parameter in JComboBox")

[getPrototypeDisplayValue](../../javax/swing/JComboBox.html#getPrototypeDisplayValue--)()

Returns the "prototypical display" value - an Object used for the calculation of the display height and width.

[ListCellRenderer](../../javax/swing/ListCellRenderer.html "interface in javax.swing")<? super [E](../../javax/swing/JComboBox.html "type parameter in JComboBox")>

[getRenderer](../../javax/swing/JComboBox.html#getRenderer--)()

Returns the renderer used to display the selected item in theJComboBox field.

int

[getSelectedIndex](../../javax/swing/JComboBox.html#getSelectedIndex--)()

Returns the first item in the list that matches the given item.

[Object](../../java/lang/Object.html "class in java.lang")

[getSelectedItem](../../javax/swing/JComboBox.html#getSelectedItem--)()

Returns the current selected item.

[Object](../../java/lang/Object.html "class in java.lang")[]

[getSelectedObjects](../../javax/swing/JComboBox.html#getSelectedObjects--)()

Returns an array containing the selected item.

[ComboBoxUI](../../javax/swing/plaf/ComboBoxUI.html "class in javax.swing.plaf")

[getUI](../../javax/swing/JComboBox.html#getUI--)()

Returns the L&F object that renders this component.

[String](../../java/lang/String.html "class in java.lang")

[getUIClassID](../../javax/swing/JComboBox.html#getUIClassID--)()

Returns the name of the L&F class that renders this component.

void

[hidePopup](../../javax/swing/JComboBox.html#hidePopup--)()

Causes the combo box to close its popup window.

void

[insertItemAt](../../javax/swing/JComboBox.html#insertItemAt-E-int-)([E](../../javax/swing/JComboBox.html "type parameter in JComboBox") item, int index)

Inserts an item into the item list at a given index.

protected void

[installAncestorListener](../../javax/swing/JComboBox.html#installAncestorListener--)()

void

[intervalAdded](../../javax/swing/JComboBox.html#intervalAdded-javax.swing.event.ListDataEvent-)([ListDataEvent](../../javax/swing/event/ListDataEvent.html "class in javax.swing.event") e)

This method is public as an implementation side effect.

void

[intervalRemoved](../../javax/swing/JComboBox.html#intervalRemoved-javax.swing.event.ListDataEvent-)([ListDataEvent](../../javax/swing/event/ListDataEvent.html "class in javax.swing.event") e)

This method is public as an implementation side effect.

boolean

[isEditable](../../javax/swing/JComboBox.html#isEditable--)()

Returns true if the JComboBox is editable.

boolean

[isLightWeightPopupEnabled](../../javax/swing/JComboBox.html#isLightWeightPopupEnabled--)()

Gets the value of the lightWeightPopupEnabled property.

boolean

[isPopupVisible](../../javax/swing/JComboBox.html#isPopupVisible--)()

Determines the visibility of the popup.

protected [String](../../java/lang/String.html "class in java.lang")

[paramString](../../javax/swing/JComboBox.html#paramString--)()

Returns a string representation of this JComboBox.

protected boolean

[processKeyBinding](../../javax/swing/JComboBox.html#processKeyBinding-javax.swing.KeyStroke-java.awt.event.KeyEvent-int-boolean-)([KeyStroke](../../javax/swing/KeyStroke.html "class in javax.swing") ks,[KeyEvent](../../java/awt/event/KeyEvent.html "class in java.awt.event") e, int condition, boolean pressed)

Invoked to process the key bindings for ks as the result of the KeyEvent e.

void

[processKeyEvent](../../javax/swing/JComboBox.html#processKeyEvent-java.awt.event.KeyEvent-)([KeyEvent](../../java/awt/event/KeyEvent.html "class in java.awt.event") e)

Handles KeyEvents, looking for the Tab key.

void

[removeActionListener](../../javax/swing/JComboBox.html#removeActionListener-java.awt.event.ActionListener-)([ActionListener](../../java/awt/event/ActionListener.html "interface in java.awt.event") l)

Removes an ActionListener.

void

[removeAllItems](../../javax/swing/JComboBox.html#removeAllItems--)()

Removes all items from the item list.

void

[removeItem](../../javax/swing/JComboBox.html#removeItem-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") anObject)

Removes an item from the item list.

void

[removeItemAt](../../javax/swing/JComboBox.html#removeItemAt-int-)(int anIndex)

Removes the item at anIndex This method works only if the JComboBox uses a mutable data model.

void

[removeItemListener](../../javax/swing/JComboBox.html#removeItemListener-java.awt.event.ItemListener-)([ItemListener](../../java/awt/event/ItemListener.html "interface in java.awt.event") aListener)

Removes an ItemListener.

void

[removePopupMenuListener](../../javax/swing/JComboBox.html#removePopupMenuListener-javax.swing.event.PopupMenuListener-)([PopupMenuListener](../../javax/swing/event/PopupMenuListener.html "interface in javax.swing.event") l)

Removes a PopupMenuListener.

protected void

[selectedItemChanged](../../javax/swing/JComboBox.html#selectedItemChanged--)()

This protected method is implementation specific.

boolean

[selectWithKeyChar](../../javax/swing/JComboBox.html#selectWithKeyChar-char-)(char keyChar)

Selects the list item that corresponds to the specified keyboard character and returns true, if there is an item corresponding to that character.

void

[setAction](../../javax/swing/JComboBox.html#setAction-javax.swing.Action-)([Action](../../javax/swing/Action.html "interface in javax.swing") a)

Sets the Action for the ActionEvent source.

void

[setActionCommand](../../javax/swing/JComboBox.html#setActionCommand-java.lang.String-)([String](../../java/lang/String.html "class in java.lang") aCommand)

Sets the action command that should be included in the event sent to action listeners.

void

[setEditable](../../javax/swing/JComboBox.html#setEditable-boolean-)(boolean aFlag)

Determines whether the JComboBox field is editable.

void

[setEditor](../../javax/swing/JComboBox.html#setEditor-javax.swing.ComboBoxEditor-)([ComboBoxEditor](../../javax/swing/ComboBoxEditor.html "interface in javax.swing") anEditor)

Sets the editor used to paint and edit the selected item in theJComboBox field.

void

[setEnabled](../../javax/swing/JComboBox.html#setEnabled-boolean-)(boolean b)

Enables the combo box so that items can be selected.

void

[setKeySelectionManager](../../javax/swing/JComboBox.html#setKeySelectionManager-javax.swing.JComboBox.KeySelectionManager-)([JComboBox.KeySelectionManager](../../javax/swing/JComboBox.KeySelectionManager.html "interface in javax.swing") aManager)

Sets the object that translates a keyboard character into a list selection.

void

[setLightWeightPopupEnabled](../../javax/swing/JComboBox.html#setLightWeightPopupEnabled-boolean-)(boolean aFlag)

Sets the lightWeightPopupEnabled property, which provides a hint as to whether or not a lightweightComponent should be used to contain theJComboBox, versus a heavyweightComponent such as a Panel or a Window.

void

[setMaximumRowCount](../../javax/swing/JComboBox.html#setMaximumRowCount-int-)(int count)

Sets the maximum number of rows the JComboBox displays.

void

[setModel](../../javax/swing/JComboBox.html#setModel-javax.swing.ComboBoxModel-)([ComboBoxModel](../../javax/swing/ComboBoxModel.html "interface in javax.swing")<[E](../../javax/swing/JComboBox.html "type parameter in JComboBox")> aModel)

Sets the data model that the JComboBox uses to obtain the list of items.

void

[setPopupVisible](../../javax/swing/JComboBox.html#setPopupVisible-boolean-)(boolean v)

Sets the visibility of the popup.

void

[setPrototypeDisplayValue](../../javax/swing/JComboBox.html#setPrototypeDisplayValue-E-)([E](../../javax/swing/JComboBox.html "type parameter in JComboBox") prototypeDisplayValue)

Sets the prototype display value used to calculate the size of the display for the UI portion.

void

[setRenderer](../../javax/swing/JComboBox.html#setRenderer-javax.swing.ListCellRenderer-)([ListCellRenderer](../../javax/swing/ListCellRenderer.html "interface in javax.swing")<? super [E](../../javax/swing/JComboBox.html "type parameter in JComboBox")> aRenderer)

Sets the renderer that paints the list items and the item selected from the list in the JComboBox field.

void

[setSelectedIndex](../../javax/swing/JComboBox.html#setSelectedIndex-int-)(int anIndex)

Selects the item at index anIndex.

void

[setSelectedItem](../../javax/swing/JComboBox.html#setSelectedItem-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") anObject)

Sets the selected item in the combo box display area to the object in the argument.

void

[setUI](../../javax/swing/JComboBox.html#setUI-javax.swing.plaf.ComboBoxUI-)([ComboBoxUI](../../javax/swing/plaf/ComboBoxUI.html "class in javax.swing.plaf") ui)

Sets the L&F object that renders this component.

void

[showPopup](../../javax/swing/JComboBox.html#showPopup--)()

Causes the combo box to display its popup window.

void

[updateUI](../../javax/swing/JComboBox.html#updateUI--)()

Resets the UI property to a value from the current look and feel.