com.jidesoft.swing
Class AutoCompletion

public class AutoCompletion
AutoCompletion is a helper class to make JTextComponent or JComboBox auto-complete based on a list of known items.

There are three constructors. The simplest one is AutoCompletion(JComboBox) . It takes any combobox and make it auto completion. If you are looking for an auto-complete combobox solution, this is all you need. However AutoCompletion can do more than that. There are two more constrcutors. One is AutoCompletion(JTextComponent, Searchable) . It will use Searchable which is another component available in JIDE to make the JTextCompoent auto-complete. We used Searchable here because it provides a common interface to access the element in JTree, JList or JTable. In the other word, the known list item we used to auto-complete can be got from JTree or JList or even JTable or any other component as long as it has Searchable interface implemented. The last constrcutor takes any java.util.List and use it as auto completion list.

The only option available on AutoCompletion is setStrict(boolean) . If it's true, it will not allow user to type in anything that is not in the known item list. If false, user can type in whatever he/she wants. If the text can match with a item in the known item list, it will still auto-complete.

SinceNot specified.
VersionNot specified.
AuthorThomas Bierhance, JIDE Software, Inc.
Wiki javadoc Use textile entry format.
Add your comments here.
Constructor Summary
AutoCompletion( JComboBox comboBox )
No description provided.
AutoCompletion( JComboBox comboBox, Searchable searchable )
No description provided.
AutoCompletion( JTextComponent textComponent, Searchable searchable )
No description provided.
AutoCompletion( JTextComponent textComponent, List list )
No description provided.
AutoCompletion( JTextComponent textComponent, Object [] array )
No description provided.
Method Summary
protected AutoCompletion.AutoCompletionDocument createDocument()
Creates AutoCompletionDocument.
Searchable getSearchable()
Gets the underlying Searchable.
protected JTextComponent getTextComponent()
Gets the underlying text component which auto-completes.
boolean isStrict()
Gets the strict property.
boolean isStrictCompletion()
Gets the strict completion property.
void setStrict( boolean strict )
Sets the strict property.
void setStrictCompletion( boolean strictCompletion )
Sets the strict completion property.
AutoCompletion
public AutoCompletion ( JComboBox comboBox )
No description provided.
Parameters
TypeNameDescription
JComboBox comboBox No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
AutoCompletion
public AutoCompletion ( JComboBox comboBox, Searchable searchable )
No description provided.
Parameters
TypeNameDescription
JComboBox comboBox No description provided.
Searchable searchable No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
AutoCompletion
public AutoCompletion ( JTextComponent textComponent, Searchable searchable )
No description provided.
Parameters
TypeNameDescription
JTextComponent textComponent No description provided.
Searchable searchable No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
AutoCompletion
public AutoCompletion ( JTextComponent textComponent, List list )
No description provided.
Parameters
TypeNameDescription
JTextComponent textComponent No description provided.
List list No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
AutoCompletion
public AutoCompletion ( JTextComponent textComponent, Object [] array )
No description provided.
Parameters
TypeNameDescription
JTextComponent textComponent No description provided.
Object [] array No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
createDocument
protected AutoCompletion.AutoCompletionDocument createDocument ( )
Creates AutoCompletionDocument.
Wiki javadoc Use textile entry format.
Add your comments here.
getSearchable
public Searchable getSearchable ( )
Gets the underlying Searchable. If you use the constructor AutoCompletion(JTextComponent, Searchable) , the return value will be the Searcable you passed in. If you use the other two constrcutors, internally we will still create a Searchable. If so, this Searchable will be returned.
Wiki javadoc Use textile entry format.
Add your comments here.
getTextComponent
protected JTextComponent getTextComponent ( )
Gets the underlying text component which auto-completes.
Wiki javadoc Use textile entry format.
Add your comments here.
isStrict
public boolean isStrict ( )
Gets the strict property.
Wiki javadoc Use textile entry format.
Add your comments here.
isStrictCompletion
public boolean isStrictCompletion ( )
Gets the strict completion property.
Wiki javadoc Use textile entry format.
Add your comments here.
setStrict
public void setStrict ( boolean strict )
Sets the strict property. If true, it will not allow user to type in anything that is not in the known item list. If false, user can type in whatever he/she wants. If the text can match with a item in the known item list, it will still auto-complete.
Parameters
TypeNameDescription
boolean strict No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setStrictCompletion
public void setStrictCompletion ( boolean strictCompletion )
Sets the strict completion property. If true, in case insensitive searching, it will always use the exact item in the Searchable to replace whatever user types. For example, when Searchable has an item "Arial" and user types in "AR", if this flag is true, it will autocompleted as "Arial". If false, it will be autocompleted as "ARial". Of course, this flag will only make a difference if Searchable is case insensitive.
Parameters
TypeNameDescription
boolean strictCompletion No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.