public class TextComponentAdaptor extends AbstractAutoCompleteAdaptor
Modifier and Type | Field and Description |
---|---|
(package private) List<?> |
items
a List containing the strings to be used for automatic
completion
|
(package private) Object |
selectedItem
the item that is currently selected
|
(package private) JTextComponent |
textComponent
the text component that is used for automatic completion
|
Constructor and Description |
---|
TextComponentAdaptor(JTextComponent textComponent,
List<?> items)
Creates a new TextComponentAdaptor for the given list and text
component.
|
Modifier and Type | Method and Description |
---|---|
Object |
getItem(int index)
Returns the item at a given index.
|
int |
getItemCount()
Returns the number of items in the list.
|
Object |
getSelectedItem()
Returns the currently selected item.
|
JTextComponent |
getTextComponent()
Returns the text component that is being used for the automatic completion.
|
void |
setSelectedItem(Object item)
Sets the selected item.
|
getSelectedItemAsString, listContainsSelectedItem, markEntireText, markText, setSelectedItemAsString
JTextComponent textComponent
Object selectedItem
public TextComponentAdaptor(JTextComponent textComponent, List<?> items)
items
- a List that contains the items that are used for
automatic completiontextComponent
- the text component that will be used automatic
completionpublic Object getSelectedItem()
AbstractAutoCompleteAdaptor
getSelectedItem
in class AbstractAutoCompleteAdaptor
public int getItemCount()
AbstractAutoCompleteAdaptor
getItemCount
in class AbstractAutoCompleteAdaptor
public Object getItem(int index)
AbstractAutoCompleteAdaptor
0<=index<getItemCount()
.getItem
in class AbstractAutoCompleteAdaptor
index
- the index of the item that is to be returnedindex
public void setSelectedItem(Object item)
AbstractAutoCompleteAdaptor
setSelectedItem
in class AbstractAutoCompleteAdaptor
item
- the item that is to be selectedpublic JTextComponent getTextComponent()
AbstractAutoCompleteAdaptor
getTextComponent
in class AbstractAutoCompleteAdaptor
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses