public class BasicComboBoxEditor extends java.lang.Object implements javax.swing.ComboBoxEditor, java.awt.event.FocusListener
BasicComboBoxUI class. This editor uses a
JTextField as the editor component.| Modifier and Type | Class and Description |
|---|---|
static class |
BasicComboBoxEditor.UIResource
A subclass of
BasicComboBoxEditor that implements the
BasicComboBoxEditor.UIResource interface. |
| Modifier and Type | Field and Description |
|---|---|
protected javax.swing.JTextField |
editor
The editor component.
|
| Constructor and Description |
|---|
BasicComboBoxEditor()
Creates a new
BasicComboBoxEditor instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
addActionListener(java.awt.event.ActionListener l)
Adds an
ActionListener to the editor component. |
void |
focusGained(java.awt.event.FocusEvent e)
This method is called when textfield gains focus.
|
void |
focusLost(java.awt.event.FocusEvent e)
This method is called when textfield loses focus.
|
java.awt.Component |
getEditorComponent()
Returns the component that will be used by the combo box to display and
edit the currently selected item in the combo box.
|
java.lang.Object |
getItem()
Returns the text from the editor component.
|
void |
removeActionListener(java.awt.event.ActionListener l)
Removes the
ActionListener from the editor component. |
void |
selectAll()
Selects all the text in the editor component.
|
void |
setItem(java.lang.Object item)
Sets item that should be edited when any editing operation is performed
by the user.
|
protected javax.swing.JTextField editor
public BasicComboBoxEditor()
BasicComboBoxEditor instance.public java.awt.Component getEditorComponent()
getEditorComponent in interface javax.swing.ComboBoxEditorJTextField in this case.public void setItem(java.lang.Object item)
setItem in interface javax.swing.ComboBoxEditoritem - item that is currently selected in the combo boxpublic java.lang.Object getItem()
getItem in interface javax.swing.ComboBoxEditorpublic void selectAll()
selectAll in interface javax.swing.ComboBoxEditorpublic void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenere - the FocusEvent describing change in focus.public void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenere - the FocusEvent describing change in focuspublic void addActionListener(java.awt.event.ActionListener l)
ActionListener to the editor component. If the user will
edit currently selected item in the textfield and pressEnter, then action
will be performed. The actionPerformed of this ActionListener should
change the selected item of the comboBox to the newly editted selected
item.addActionListener in interface javax.swing.ComboBoxEditorl - the ActionListener responsible for changing selected item of the
combo box when it is editted by the user.public void removeActionListener(java.awt.event.ActionListener l)
ActionListener from the editor component.removeActionListener in interface javax.swing.ComboBoxEditorl - the listener to remove.