Class BeanListComboBoxEditor<T>
- java.lang.Object
-
- javax.swing.plaf.basic.BasicComboBoxEditor
-
- io.github.jonestimd.swing.component.BeanListComboBoxEditor<T>
-
- Type Parameters:
T
-BeanListComboBox
list item class
- All Implemented Interfaces:
java.awt.event.FocusListener
,java.util.EventListener
,javax.swing.ComboBoxEditor
public class BeanListComboBoxEditor<T> extends javax.swing.plaf.basic.BasicComboBoxEditor
Provides the text field (ValidatedTextField
) for an editableBeanListComboBox
. UsesFormat.parseObject(String)
to create an item from the input text.
-
-
Constructor Summary
Constructors Constructor Description BeanListComboBoxEditor(javax.swing.JComboBox<T> comboBox, java.text.Format format, Validator<java.lang.String> validator)
Create a combo box editor with the defaultPrefixSelector
(first match alphabetically).BeanListComboBoxEditor(javax.swing.JComboBox<T> comboBox, java.text.Format format, Validator<java.lang.String> validator, PrefixSelector<T> prefixSelector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidatedTextField
getEditorComponent()
protected java.lang.String
getFirstMatch(java.lang.String displayText)
T
getItem()
protected T
getItem(java.lang.String displayText)
boolean
isAutoSelecting()
boolean
isNew(java.lang.Object item)
protected java.lang.String
itemToString(java.lang.Object item)
protected T
parseInput(java.lang.String displayText)
void
setItem(java.lang.Object anObject)
-
-
-
Constructor Detail
-
BeanListComboBoxEditor
public BeanListComboBoxEditor(javax.swing.JComboBox<T> comboBox, java.text.Format format, Validator<java.lang.String> validator)
Create a combo box editor with the defaultPrefixSelector
(first match alphabetically).
-
BeanListComboBoxEditor
public BeanListComboBoxEditor(javax.swing.JComboBox<T> comboBox, java.text.Format format, Validator<java.lang.String> validator, PrefixSelector<T> prefixSelector)
-
-
Method Detail
-
isAutoSelecting
public boolean isAutoSelecting()
-
getEditorComponent
public ValidatedTextField getEditorComponent()
- Specified by:
getEditorComponent
in interfacejavax.swing.ComboBoxEditor
- Overrides:
getEditorComponent
in classjavax.swing.plaf.basic.BasicComboBoxEditor
-
setItem
public void setItem(java.lang.Object anObject)
- Specified by:
setItem
in interfacejavax.swing.ComboBoxEditor
- Overrides:
setItem
in classjavax.swing.plaf.basic.BasicComboBoxEditor
-
getItem
public T getItem()
- Specified by:
getItem
in interfacejavax.swing.ComboBoxEditor
- Overrides:
getItem
in classjavax.swing.plaf.basic.BasicComboBoxEditor
-
isNew
public boolean isNew(java.lang.Object item)
-
getItem
protected T getItem(java.lang.String displayText)
-
parseInput
protected T parseInput(java.lang.String displayText)
-
itemToString
protected java.lang.String itemToString(java.lang.Object item)
-
getFirstMatch
protected java.lang.String getFirstMatch(java.lang.String displayText)
-
-