public class ComboCompleterFilter extends AbstractCompleterFilter
To add to a combo, call the static method addCompletionMechanism(yourCombo), or do the following:
if (!(myCombo.getEditor().getEditorComponent() instanceof JTextField)) return;
JTextField tf = (JTextField)myCombo.getEditor().getEditorComponent(); PlainDocument pd = new PlainDocument(); this.filter = new ComboCompleterFilter(myCombo); pd.setDocumentFilter(this.filter); tf.setDocument(pd);
DocumentFilter.FilterBypasscaseSensitive, corrective, firstSelectedIndex, preText, strict| Constructor and Description |
|---|
ComboCompleterFilter(JComboBox combo)
Creates a new ComboCompleterFilter object.
|
| Modifier and Type | Method and Description |
|---|---|
static ComboCompleterFilter |
addCompletionMechanism(JComboBox combo)
Helper method to add auto-completion to a jcombobox or derivation.
|
int |
getCompleterListSize()
DOCUMENT ME!
|
Object |
getCompleterObjectAt(int i)
DOCUMENT ME!
|
String |
getNullRespresentation()
DOCUMENT ME!
|
JTextField |
getTextField()
DOCUMENT ME!
|
void |
remove(DocumentFilter.FilterBypass filterBypass,
int offset,
int length) |
void |
replace(DocumentFilter.FilterBypass filterBypass,
int offset,
int length,
String string,
AttributeSet attributeSet) |
void |
setNullRespresentation(String nullRespresentation)
DOCUMENT ME!
|
void |
setStrict(boolean strict)
DOCUMENT ME!
|
getLeadingSelectedIndex, insertString, isCaseSensitive, isCorrectingCase, isStrict, setCaseSensitive, setCorrectCasepublic ComboCompleterFilter(JComboBox combo)
combo - DOCUMENT ME!public String getNullRespresentation()
public void setNullRespresentation(String nullRespresentation)
nullRespresentation - the nullRespresentation to setpublic int getCompleterListSize()
AbstractCompleterFiltergetCompleterListSize in class AbstractCompleterFilterpublic Object getCompleterObjectAt(int i)
AbstractCompleterFiltergetCompleterObjectAt in class AbstractCompleterFilteri - DOCUMENT ME!public JTextField getTextField()
AbstractCompleterFiltergetTextField in class AbstractCompleterFilterpublic static ComboCompleterFilter addCompletionMechanism(JComboBox combo)
The look and feel must use a JTextField as the combo box editor (or null will be returned).
The JTextField will have it's document set to a new PlainDocument and the returned filter will be set to autocomplete the contents. Use the returned filter to set options such as case-sensitivity.
combo - DOCUMENT ME!public void replace(DocumentFilter.FilterBypass filterBypass, int offset, int length, String string, AttributeSet attributeSet) throws BadLocationException
replace in class AbstractCompleterFilterBadLocationExceptionpublic void remove(DocumentFilter.FilterBypass filterBypass, int offset, int length) throws BadLocationException
remove in class AbstractCompleterFilterBadLocationExceptionpublic void setStrict(boolean strict)
AbstractCompleterFiltersetStrict in class AbstractCompleterFilterstrict - the this.strict to setCopyright © 2012–2026 cismet GmbH. All rights reserved.