Java javax.swing JComboBox fields, constructors, methods, implement or subclass

Example usage for Java javax.swing JComboBox fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for javax.swing JComboBox.

The text is from its open source code.

Subclass

javax.swing.JComboBox has subclasses.
Click this link to see all its subclasses.

Field

booleanisEditable
This protected field is implementation specific.

Constructor

JComboBox(ComboBoxModel aModel)
Creates a JComboBox that takes its items from an existing ComboBoxModel.
JComboBox(E[] items)
Creates a JComboBox that contains the elements in the specified array.
JComboBox(Vector items)
Creates a JComboBox that contains the elements in the specified Vector.
JComboBox()
Creates a JComboBox with a default data model.

Method

voidaddActionListener(ActionListener l)
Adds an ActionListener.
voidaddAncestorListener(AncestorListener listener)
Registers listener so that it will receive AncestorEvents when it or any of its ancestors move or are made visible or invisible.
voidaddFocusListener(FocusListener l)
Adds the specified focus listener to receive focus events from this component when this component gains input focus.
voidaddItem(E item)
Adds an item to the item list.
voidaddItemListener(ItemListener aListener)
Adds an ItemListener.
voidaddKeyListener(KeyListener l)
Adds the specified key listener to receive key events from this component.
voidaddPopupMenuListener(PopupMenuListener l)
Adds a PopupMenu listener which will listen to notification messages from the popup portion of the combo box.
voidfirePopupMenuCanceled()
Notifies PopupMenuListeners that the popup portion of the combo box has been canceled.
voidfirePopupMenuWillBecomeInvisible()
Notifies PopupMenuListeners that the popup portion of the combo box has become invisible.
voidfirePopupMenuWillBecomeVisible()
Notifies PopupMenuListeners that the popup portion of the combo box will become visible.
AccessibleContextgetAccessibleContext()
Gets the AccessibleContext associated with this JComboBox.
ActiongetAction()
Returns the currently set Action for this ActionEvent source, or null if no Action is set.
StringgetActionCommand()
Returns the action command that is included in the event sent to action listeners.
ActionListener[]getActionListeners()
Returns an array of all the ActionListeners added to this JComboBox with addActionListener().
RectanglegetBounds()
Gets the bounds of this component in the form of a Rectangle object.
Component[]getComponents()
Gets all the components in this container.
ComboBoxEditorgetEditor()
Returns the editor used to paint and edit the selected item in the JComboBox field.
FontgetFont()
Gets the font of this component.
FontMetricsgetFontMetrics(Font font)
Gets the FontMetrics for the specified Font.
InputMapgetInputMap(int condition)
Returns the InputMap that is used during condition.
EgetItemAt(int index)
Returns the list item at the specified index.
intgetItemCount()
Returns the number of items in the list.
ItemListener[]getItemListeners()
Returns an array of all the ItemListeners added to this JComboBox with addItemListener().
KeyListener[]getKeyListeners()
Returns an array of all the key listeners registered on this component.
KeySelectionManagergetKeySelectionManager()
Returns the list's key-selection manager.
intgetMaximumRowCount()
Returns the maximum number of items the combo box can display without a scrollbar
DimensiongetMinimumSize()
If the minimum size has been set to a non-null value just returns it.
ComboBoxModelgetModel()
Returns the data model currently used by the JComboBox.
StringgetName()
Gets the name of the component.
ContainergetParent()
Gets the parent of this component.
PopupMenuListener[]getPopupMenuListeners()
Returns an array of all the PopupMenuListeners added to this JComboBox with addPopupMenuListener().
DimensiongetPreferredSize()
If the preferredSize has been set to a non-null value just returns it.
EgetPrototypeDisplayValue()
Returns the "prototypical display" value - an Object used for the calculation of the display height and width.
ListCellRenderergetRenderer()
Returns the renderer used to display the selected item in the JComboBox field.
intgetSelectedIndex()
Returns the first item in the list that matches the given item.
ObjectgetSelectedItem()
Returns the current selected item.
Object[]getSelectedObjects()
Returns an array containing the selected item.
DimensiongetSize()
Returns the size of this component in the form of a Dimension object.
ComboBoxUIgetUI()
Returns the L&F object that renders this component.
voidhidePopup()
Causes the combo box to close its popup window.
voidinsertItemAt(E item, int index)
Inserts an item into the item list at a given index.
booleanisDisplayable()
Determines whether this component is displayable.
booleanisEnabled()
Determines whether this component is enabled.
booleanisLightWeightPopupEnabled()
Gets the value of the lightWeightPopupEnabled property.
booleanisPopupVisible()
Determines the visibility of the popup.
booleanisShowing()
Determines whether this component is showing on screen.
booleanisVisible()
Determines whether this component should be visible when its parent is visible.
voidputClientProperty(Object key, Object value)
Adds an arbitrary key/value "client property" to this component.
voidremoveActionListener(ActionListener l)
Removes an ActionListener.
voidremoveAll()
Removes all the components from this container.
voidremoveAllItems()
Removes all items from the item list.
voidremoveItem(Object anObject)
Removes an item from the item list.
voidremoveItemAt(int anIndex)
Removes the item at anIndex This method works only if the JComboBox uses a mutable data model.
voidremoveItemListener(ItemListener aListener)
Removes an ItemListener.
voidremoveKeyListener(KeyListener l)
Removes the specified key listener so that it no longer receives key events from this component.
voidrepaint()
Repaints this component.
booleanrequestFocusInWindow()
Requests that this Component gets the input focus.
voidrevalidate()
Supports deferred automatic layout.
voidsetAction(Action a)
Sets the Action for the ActionEvent source.
voidsetActionCommand(String aCommand)
Sets the action command that should be included in the event sent to action listeners.
voidsetAlignmentX(float alignmentX)
Sets the horizontal alignment.
voidsetBackground(Color bg)
Sets the background color of this component.
voidsetBorder(Border border)
Sets the border of this component.
voidsetBounds(int x, int y, int width, int height)
Moves and resizes this component.
voidsetComponentOrientation(ComponentOrientation o)
Sets the language-sensitive orientation that is to be used to order the elements or text within this component.
voidsetEditable(boolean aFlag)
Determines whether the JComboBox field is editable.
voidsetEditor(ComboBoxEditor anEditor)
Sets the editor used to paint and edit the selected item in the JComboBox field.
voidsetEnabled(boolean b)
Enables the combo box so that items can be selected.
voidsetFocusable(boolean focusable)
Sets the focusable state of this Component to the specified value.
voidsetFont(Font font)
Sets the font for this component.
voidsetKeySelectionManager(KeySelectionManager aManager)
Sets the object that translates a keyboard character into a list selection.
voidsetLightWeightPopupEnabled(boolean aFlag)
Sets the lightWeightPopupEnabled property, which provides a hint as to whether or not a lightweight Component should be used to contain the JComboBox, versus a heavyweight Component such as a Panel or a Window.
voidsetMaximumRowCount(int count)
Sets the maximum number of rows the JComboBox displays.
voidsetMaximumSize(Dimension maximumSize)
Sets the maximum size of this component to a constant value.
voidsetMinimumSize(Dimension minimumSize)
Sets the minimum size of this component to a constant value.
voidsetModel(ComboBoxModel aModel)
Sets the data model that the JComboBox uses to obtain the list of items.
voidsetName(String name)
Sets the name of the component to the specified string.
voidsetOpaque(boolean isOpaque)
If true the component paints every pixel within its bounds.
voidsetPopupVisible(boolean v)
Sets the visibility of the popup.
voidsetPreferredSize(Dimension preferredSize)
Sets the preferred size of this component.
voidsetPrototypeDisplayValue(E prototypeDisplayValue)
Sets the prototype display value used to calculate the size of the display for the UI portion.
voidsetRenderer(ListCellRenderer aRenderer)
Sets the renderer that paints the list items and the item selected from the list in the JComboBox field.
voidsetRequestFocusEnabled(boolean requestFocusEnabled)
Provides a hint as to whether or not this JComponent should get focus.
voidsetSelectedIndex(int anIndex)
Selects the item at index anIndex.
voidsetSelectedItem(Object anObject)
Sets the selected item in the combo box display area to the object in the argument.
voidsetSize(Dimension d)
Resizes this component so that it has width d.width and height d.height .
voidsetToolTipText(String text)
Registers the text to display in a tool tip.
voidsetUI(ComboBoxUI ui)
Sets the L&F object that renders this component.
voidsetVisible(boolean aFlag)
Makes the component visible or invisible.
voidshowPopup()
Causes the combo box to display its popup window.
voidupdateUI()
Resets the UI property to a value from the current look and feel.