JComboBox

Extends
JComponent
Methods
23
Fields
1

Getting one

JComboBox.new()

Methods

MethodReturnsDescription
getMaximumRowCount()numberHow many rows the popup shows before it scrolls (the look's 15 until set).
setMaximumRowCount(number)()Sets how many rows the popup shows before it scrolls.
isPopupVisible()booleanWhether the popup is open.
setPopupVisible(boolean)()Opens or closes the popup (it opens only while the box is showing and has rows).
showPopup()()Opens the popup.
hidePopup()()Closes the popup.
addActionListener(any)()Adds an ActionListener (a table with actionPerformed, or that function): it hears every setSelectedItem and every choice, the last ad…
removeActionListener(any)()Removes an ActionListener, by identity.
getActionListeners(){any}The ActionListeners, in registration order.
addItemListener(any)()Adds an ItemListener (a table with itemStateChanged, or that function): when the selected item changes it hears the old one `DESELECTED…
removeItemListener(any)()Removes an ItemListener, by identity.
getItemListeners(){any}The ItemListeners, in registration order.
addItem(any)()Appends to the model (a MutableComboBoxModel).
getItemAt(number)anyThe row's item, nil outside the rows.
getItemCount()numberHow many rows.
getSelectedItem()anyThe model's selected item.
removeAllItems()()Empties the model.
setModel(any)()Shows model; nil raises.
setRenderer(ListCellRenderer)()A ListCellRenderer for the box's value (index -1) and the popup's rows; nil restores the default.
setSelectedItem(any)()o becomes the selected item when it is one of the rows (or nil); the action fires either way.
new()JComboBox() -> JComboBox: An empty combo box (its model an empty DefaultComboBoxModel).
new({ n: number, [number]: any? })JComboBox
init(JComboBox)()(JComboBox) -> (): An empty combo box (its model an empty DefaultComboBoxModel).
init(JComboBox, { n: number, [number]: any? })()
isInstance(any)booleanWhether obj is a JComboBox object, a class(JComboBox) subclass's included.

Fields

FieldTypeDescription
superJComponentClassJComponent's class table: the base class.

Returned by

MethodReturnsDescription
JComboBoxClass.newJComboBox() -> JComboBox: An empty combo box (its model an empty DefaultComboBoxModel).

Method details

setPopupVisible

setPopupVisible: (JComboBox, boolean) -> ()

Opens or closes the popup (it opens only while the box is showing and has rows).

addActionListener

addActionListener: (JComboBox, any) -> ()

Adds an ActionListener (a table with actionPerformed, or that function): it hears every setSelectedItem and every choice, the last added first; the command is "comboBoxChanged".

addItemListener

addItemListener: (JComboBox, any) -> ()

Adds an ItemListener (a table with itemStateChanged, or that function): when the selected item changes it hears the old one DESELECTED, then the new one SELECTED, the last added first.

addItem

addItem: (JComboBox, any) -> ()

Appends to the model (a MutableComboBoxModel).

setSelectedItem

setSelectedItem: (JComboBox, any) -> ()

o becomes the selected item when it is one of the rows (or nil); the action fires either way.

new

new: (() -> JComboBox) & (({ n: number, [number]: any? }) -> JComboBox)

() -> JComboBox: An empty combo box (its model an empty DefaultComboBoxModel).

({ n: number, [number]: any? }) -> JComboBox: A combo box over items (an array, its first element selected), or over a ComboBoxModel given in its place (a table with getSize, getElementAt, getSelectedItem and setSelectedItem, as new JComboBox(model) takes it).

init

init: ((JComboBox) -> ()) & ((JComboBox, { n: number, [number]: any? }) -> ())

(JComboBox) -> (): An empty combo box (its model an empty DefaultComboBoxModel).

(JComboBox, { n: number, [number]: any? }) -> (): A combo box over items (an array, its first element selected), or over a ComboBoxModel given in its place (a table with getSize, getElementAt, getSelectedItem and setSelectedItem, as new JComboBox(model) takes it).

isInstance

isInstance: (any) -> boolean

Whether obj is a JComboBox object, a class(JComboBox) subclass's included.