class org.aswing.JComboBox extends Component
Interfaces | |||
EditableComponent |
|
A component that combines a button or editable field and a drop-down list. The user can select a value from the drop-down list, which appears at the user's request. If you make the combo box editable, then the combo box includes an editable field into which the user can type a value.
JComboBox
use a JList
to be the drop-down list,
so of course you can operate list to do some thing.
By default JComboBox
can't count its preffered width accurately
like default JList, you have to set its preffered size if you want.
Or you make a not shared cell factory to it. see ListCellFactory
and JList
for details.
Show Events | Hide Events
|
Instance Fields
Determines whether the JComboBox
field is editable.
An editable JComboBox
allows the user to type into the
field or selected an item from the list to initialize the field,
after which it can be edited. (The editing affects only the field,
the list item remains intact.) A non editable JComboBox
displays the selected item in the field,
but the selection cannot be modified.
var editor:ComboBoxEditor
An editor used to paint and edit the selected item in the
JComboBox
field.
The editor is used both if the
receiving JComboBox
is editable and not editable.
var listCellFactory:ListCellFactory
A cell factory for the popup List.
Setting will cause all cells recreating by new factory.
var maximumRowCount:Int
A maximum number of rows the JComboBox
displays.
If the number of objects in the model is greater than count, the combo box uses a scrollbar.
var selectedItem:Dynamic
The selected item in the combo box display area.
If item
is in the list, the display area shows
item
selected.
If item
is not in the list and the combo box is
uneditable, it will not change the current selection. For editable
combo boxes, the selection will change to item
.
AWEvent.ACT
(this.addActionListener()
)events added to the combo box will be notified
when this method is called.InteractiveEvent.SELECTION_CHANGED
(this.addSelectionListener()
)events added to the combo box will be notified
when this method is called only when the item is different from current selected item,
it means that only when the selected item changed.function addActionListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
The ActionListener will receive an ActionEvent when a selection has been made. If the combo box is editable, then an ActionEvent will be fired when editing has stopped. @see org.aswing.event.AWEvent#ACT
listener | the listener |
priority | the priority |
useWeakReference | Determines whether the reference to the listener is strong or weak. |
function addSelectionListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
Add a listener to listen the combobox's selection change event. When the combobox's selection changed or a different value inputed or set programmiclly. @see org.aswing.event.InteractiveEvent#SELECTION_CHANGED
listener | the listener |
priority | the priority |
useWeakReference | Determines whether the reference to the listener is strong or weak. |
function getItemAt(index:Int): Dynamic
Returns the list item at the specified index. If index
is out of range (less than zero or greater than or equal to size)
it will return undefined
.
index | an integer indicating the list position, where the first item starts at zero |
returns | the |
function removeActionListener(listener:Dynamic ->Void): Void
Removes a action listener. @see org.aswing.event.AWEvent#ACT
listener | the listener to be removed. |
function removeSelectionListener(listener:Dynamic ->Void): Void
Removes a selection listener. @see org.aswing.event.InteractiveEvent#SELECTION_CHANGED
listener | the listener to be removed. |