com.jidesoft.swing
Class Searchable

public class Searchable
JList, JTable and JTree are three data-rich components. They can be used to display a huge amount of data so searching function will be very a useful feature in those components. Searchable is such a class that can make JList, JTable and JTree searchable. User can simply type in any string they want to search for and use arrow keys to navigate to next or previous occurrence.

Searchable is a base abstract class. ListSearchable, TableSearchable and TreeSearchable are implementations to make JList, JTable and JTree searchable respectively. For each implementation, there are five methods need to be implemented.

  • protected abstract int getSelectedIndex()
  • protected abstract void setSelectedIndex(int index, boolean incremental)
  • protected abstract int getElementCount()
  • protected abstract Object getElementAt(int index)
  • protected abstract String convertElementToString(Object element)

Please look at the javadoc of each method to learn more details.

The keys used by this class are fully customizable. Subclass can override the methods such as isActivateKey(KeyEvent) , isDeactivateKey(KeyEvent) , isFindFirstKey(KeyEvent) , isFindLastKey(KeyEvent) , isFindNextKey(KeyEvent) , isFindPreviousKey(KeyEvent) to provide its own set of keys.

In addition to press up/down arrow to find next occurrence or previous occurrence of particular string, there are several other features that are very handy.

Multiple selection feature - If you press CTRL key and hold it while pressing up and down arrow, it will find next/previous occurence while keeping existing selections.
Select all feature - If you type in a searching text and press CTRL+A, all the occurrences of that searching string will be selected. This is a very handy feature. For example you want to delete all rows in a table whose name column begins with "old". So you can type in "old" and press CTRL+A, now all rows begining with "old" will be selected. Pressing delete will delete all of them.
Basic regular expression support - It allows '?' to match any letter or digit, or '*' to match several letters or digits. Even though it's possible to implement full regular expression support, we don't want to do that. The reason is the regular expression is very complex, it's probably not a good idea to let user type in such a complex expression in a small popup window. However if your user is very familiar with regular expression, you can add the feature to Searchable. All you need to do is to override compare(String, String) method and implement by yourself.

As this is an abstract class, please refer to to javadoc of ListSearchable , TreeSearchable , and TableSearchable to find out how to use it with JList, JTree and JTable respectively.

This component has a timer. If user types very fast, it will accumulate them together and generate only one searching action. The timer can be controlled by setSearchingDelay(int) .

By default we will use lightweight popup for the sake of performance. But if you use heavyweight component which could obscure the lightweight popup, you can call setHeavyweightComponentEnabled(boolean) to true so that heavyweight popup will be used.

SinceNot specified.
VersionNot specified.
AuthorNot specified.
Wiki javadoc Use textile entry format.
Add your comments here.
Field Summary
protected EventListenerList listenerList
A list of event listeners for this component.
static String PROPERTY_SEARCH_TEXT
No description provided.
protected JComponent _component
No description provided.
protected ComponentAdapter _componentListener
No description provided.
Constructor Summary
Searchable( JComponent component )
Creates a Searchable.
Searchable( JComponent component, SearchableProvider searchableProvider )
Creates a Searchable.
Method Summary
void addPropertyChangeListener( PropertyChangeListener propertychangelistener )
Adds the property change listener.
void addSearchableListener( SearchableListener l )
Adds the specified listener to receive searchable events from this searchable.
protected boolean compare( Object element, String searchingText )
Checks if the element matches the searching text.
protected boolean compare( String text, String searchingText )
Checks if the element string matches the searching text.
protected String convertElementToString( Object element )
Converts the element that returns from getElementAt() to string.
protected Searchable.SearchPopup createSearchPopup( String searchingText )
Creates the popup to hold the searching text.
int findFirst( String s )
Finds the first element that matches the searching text.
int findFromCursor( String s )
Finds the next matching index from the cursor.
int findLast( String s )
Finds the last element that matches the searching text.
int findNext( String s )
Finds the next matching index from the cursor.
int findPrevious( String s )
Finds the previous matching index from the cursor.
void firePropertyChangeEvent( String searchingText )
No description provided.
protected void fireSearchableEvent( SearchableEvent e )
Fires a searchable event.
Color getBackground()
Gets the background color used inn the search popup.
Component getComponent()
Gets the actual component which installed this Searchable.
int getCursor()
Gets the cursor which is the index of current location when searching.
protected Object getElementAt( int index )
Gets the element at the specified index.
protected int getElementCount()
Gets the total element count in the component.
Color getForeground()
Gets the foreground color used inn the search popup.
Color getMismatchForeground()
Gets the foreground color when the searching text doesn't match with any of the elements in the component.
int getPopupLocation()
Gets the popup location.
Component getPopupLocationRelativeTo()
Gets the component that the location of the popup relative to.
protected String getResourceString( String key )
Gets the localized string from resource bundle.
SearchableListener[] getSearchableListeners()
Returns an array of all the SearchableListeners added to this SearchableGroup with addSearchableListener.
SearchableProvider getSearchableProvider()
No description provided.
int getSearchingDelay()
If it returns a positive number, it will wait for that many ms before doing the search.
String getSearchingText()
Gets the searching text.
String getSearchLabel()
Gets the current text that appears in the search popup.
protected int getSelectedIndex()
Gets the selected index in the component.
void hidePopup()
Hides the popup.
void installListeners()
Installs necessary listeners to the component.
protected boolean isActivateKey( KeyEvent e )
Checks if the key in KeyEvent should activate the search popup.
boolean isCaseSensitive()
Checks if the case is sensitive during searching.
protected boolean isDeactivateKey( KeyEvent e )
Checks if the key in KeyEvent should hide the search popup.
protected boolean isFindFirstKey( KeyEvent e )
Checks if the key is used as a key to find the first occurence.
protected boolean isFindLastKey( KeyEvent e )
Checks if the key is used as a key to find the last occurence.
protected boolean isFindNextKey( KeyEvent e )
Checks if the key is used as a key to find the next occurence.
protected boolean isFindPreviousKey( KeyEvent e )
Checks if the key is used as a key to find the previous occurence.
boolean isHeavyweightComponentEnabled()
No description provided.
protected boolean isIncrementalSelectKey( KeyEvent e )
Checks if the key will trigger incremental selection.
protected boolean isNavigationKey( KeyEvent e )
Checks if the key is used as a navigation key.
boolean isPopupVisible()
Check if the searchable popup is visible.
boolean isRepeats()
Checks if restart from the beginning when searching reaches the end or restart from the end when reaches beginning.
boolean isReverseOrder()
Checks the searching order.
protected boolean isSelectAllKey( KeyEvent e )
Checks if the key will trigger selecting all.
boolean isWildcardEnabled()
Checks if it supports wildcard in searching text.
protected void keyTypedOrPressed( KeyEvent e )
This method is called when a key is typed or pressed.
void removePropertyChangeListener( PropertyChangeListener propertychangelistener )
Removes the property change listener.
void removeSearchableListener( SearchableListener l )
Removes the specified searchable listener so that it no longer receives searchable events.
int reverseFindFromCursor( String s )
Finds the previous matching index from the cursor.
void setBackground( Color background )
Sets the background color used by popup.
void setCaseSensitive( boolean caseSensitive )
Sets the case sensitive flag.
void setCursor( int cursor )
Sets the cursor which is the index of current location when searching.
void setForeground( Color foreground )
Sets the foreground color used by popup.
void setHeavyweightComponentEnabled( boolean heavyweightComponentEnabled )
No description provided.
void setMismatchForeground( Color mismatchForeground )
Sets the foreground for mismatch.
void setPopupLocation( int popupLocation )
Sets the popup location.
void setPopupLocationRelativeTo( Component popupLocationRelativeTo )
Sets the location of the popup relative to the specified component.
void setRepeats( boolean repeats )
Sets the repeat flag.
void setReverseOrder( boolean reverseOrder )
Sets the searching order.
void setSearchableProvider( SearchableProvider searchableProvider )
No description provided.
void setSearchingDelay( int searchingDelay )
If this flag is set to a positive number, it will wait for that many ms before doing the search.
void setSearchLabel( String searchLabel )
Sets the text that appears in the search popup.
protected void setSelectedIndex( int index, boolean incremental )
Sets the selected index.
void setWildcardEnabled( boolean wildcardEnabled )
Enable or disable the usage of wildcard.
void showPopup( String searchingText )
Shows the search popup.
void uninstallListeners()
Uninstall the listeners that installed before.
listenerList
protected EventListenerList listenerList
A list of event listeners for this component.
Wiki javadoc Use textile entry format.
Add your comments here.
PROPERTY_SEARCH_TEXT
public static String PROPERTY_SEARCH_TEXT
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
_component
protected JComponent _component
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
_componentListener
protected ComponentAdapter _componentListener
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
Searchable
public Searchable ( JComponent component )
Creates a Searchable.
Parameters
TypeNameDescription
JComponent component component where the Searchable will be installed.
Wiki javadoc Use textile entry format.
Add your comments here.
Searchable
public Searchable ( JComponent component, SearchableProvider searchableProvider )
Creates a Searchable.
Parameters
TypeNameDescription
JComponent component component where the Searchable will be installed.
SearchableProvider searchableProvider No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
addPropertyChangeListener
public void addPropertyChangeListener ( PropertyChangeListener propertychangelistener )
Adds the property change listener. The only property change event that will be fired is the "searchText" property which will be fired when user types in a different search text in the popup.
Parameters
TypeNameDescription
PropertyChangeListener propertychangelistener No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
addSearchableListener
public void addSearchableListener ( SearchableListener l )
Adds the specified listener to receive searchable events from this searchable.
Parameters
TypeNameDescription
SearchableListener l the searchable listener
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
compare
protected boolean compare ( Object element, String searchingText )
Checks if the element matches the searching text.
Parameters
TypeNameDescription
Object element No description provided.
String searchingText No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
compare
protected boolean compare ( String text, String searchingText )
Checks if the element string matches the searching text. Different from compare(Object, String) , this method is after the element has been converted to string using convertElementToString(Object) .
Parameters
TypeNameDescription
String text No description provided.
String searchingText No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
convertElementToString
protected String convertElementToString ( Object element )
Converts the element that returns from getElementAt() to string.
Parameters
TypeNameDescription
Object element No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
createSearchPopup
protected Searchable.SearchPopup createSearchPopup ( String searchingText )
Creates the popup to hold the searching text.
Parameters
TypeNameDescription
String searchingText No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
findFirst
public int findFirst ( String s )
Finds the first element that matches the searching text.
Parameters
TypeNameDescription
String s No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
findFromCursor
public int findFromCursor ( String s )
Finds the next matching index from the cursor. If it reaches the end, it will restart from the beginning. However is the reverseOrder flag is true, it will finds the previous matching index from the cursor. If it reaches the beginning, it will restart from the end.
Parameters
TypeNameDescription
String s No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
findLast
public int findLast ( String s )
Finds the last element that matches the searching text.
Parameters
TypeNameDescription
String s No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
findNext
public int findNext ( String s )
Finds the next matching index from the cursor.
Parameters
TypeNameDescription
String s No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
findPrevious
public int findPrevious ( String s )
Finds the previous matching index from the cursor.
Parameters
TypeNameDescription
String s No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
firePropertyChangeEvent
public void firePropertyChangeEvent ( String searchingText )
No description provided.
Parameters
TypeNameDescription
String searchingText No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
fireSearchableEvent
protected void fireSearchableEvent ( SearchableEvent e )
Fires a searchable event.
Parameters
TypeNameDescription
SearchableEvent e the event
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
getBackground
public Color getBackground ( )
Gets the background color used inn the search popup.
Wiki javadoc Use textile entry format.
Add your comments here.
getComponent
public Component getComponent ( )
Gets the actual component which installed this Searchable.
Wiki javadoc Use textile entry format.
Add your comments here.
getCursor
public int getCursor ( )
Gets the cursor which is the index of current location when searching. The value will be used in findNext and findPrevious.
Wiki javadoc Use textile entry format.
Add your comments here.
getElementAt
protected Object getElementAt ( int index )
Gets the element at the specified index. The element could be any data structure that internally used in the component. The convertElementToString method will give you a chance to convert the element to string which is used to compare with the string that user types in.
Parameters
TypeNameDescription
int index the index
Wiki javadoc Use textile entry format.
Add your comments here.
getElementCount
protected int getElementCount ( )
Gets the total element count in the component. Different concrete implementation could have different interpretation of the count. This is totally OK as long as it's consistent in all the methods. For example, the index parameter in other methods should be always a valid value within the total count.
Wiki javadoc Use textile entry format.
Add your comments here.
getForeground
public Color getForeground ( )
Gets the foreground color used inn the search popup.
Wiki javadoc Use textile entry format.
Add your comments here.
getMismatchForeground
public Color getMismatchForeground ( )
Gets the foreground color when the searching text doesn't match with any of the elements in the component.
Wiki javadoc Use textile entry format.
Add your comments here.
getPopupLocation
public int getPopupLocation ( )
Gets the popup location. It could be either TOP or BOTTOM .
Wiki javadoc Use textile entry format.
Add your comments here.
getPopupLocationRelativeTo
public Component getPopupLocationRelativeTo ( )
Gets the component that the location of the popup relative to.
Wiki javadoc Use textile entry format.
Add your comments here.
getResourceString
protected String getResourceString ( String key )
Gets the localized string from resource bundle. Subclass can override it to provide its own string. Available keys are defined in swing.properties that begin with "Searchable.".
Parameters
TypeNameDescription
String key No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
getSearchableListeners
public SearchableListener[] getSearchableListeners ( )
Returns an array of all the SearchableListeners added to this SearchableGroup with addSearchableListener.
Since: 1.4
Wiki javadoc Use textile entry format.
Add your comments here.
getSearchableProvider
public SearchableProvider getSearchableProvider ( )
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
getSearchingDelay
public int getSearchingDelay ( )
If it returns a positive number, it will wait for that many ms before doing the search. When the searching is complex, this flag will be useful to make the searching efficient. In the other words, if user types in several keys very quickly, there will be only one search. If it returns 0 or negative number, each key will generate a search.
Wiki javadoc Use textile entry format.
Add your comments here.
getSearchingText
public String getSearchingText ( )
Gets the searching text.
Wiki javadoc Use textile entry format.
Add your comments here.
getSearchLabel
public String getSearchLabel ( )
Gets the current text that appears in the search popup. By default it is "Search for: ".
Wiki javadoc Use textile entry format.
Add your comments here.
getSelectedIndex
protected int getSelectedIndex ( )
Gets the selected index in the component. The concrete implementation should call methods on the component to retrieve the current selected index. If the component supports multiple selection, it's OK just return the index of the first selection.

Here are some examples. In the case of JList, the index is the row index. In the case of JTree, the index is the row index too. In the case of JTable, depending on the seleection mode, the index could be row index (in row selection mode), could be column index (in column selection mode) or could the cell index (in cell selection mode).

Wiki javadoc Use textile entry format.
Add your comments here.
hidePopup
public void hidePopup ( )
Hides the popup.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
installListeners
public void installListeners ( )
Installs necessary listeners to the component. This method will be called automatically when Searchable is created.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isActivateKey
protected boolean isActivateKey ( KeyEvent e )
Checks if the key in KeyEvent should activate the search popup.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isCaseSensitive
public boolean isCaseSensitive ( )
Checks if the case is sensitive during searching.
Wiki javadoc Use textile entry format.
Add your comments here.
isDeactivateKey
protected boolean isDeactivateKey ( KeyEvent e )
Checks if the key in KeyEvent should hide the search popup. If this method return true and the key is not used for navigation purpose ( isNavigationKey(KeyEvent) return false), the popup will be hidden.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isFindFirstKey
protected boolean isFindFirstKey ( KeyEvent e )
Checks if the key is used as a key to find the first occurence.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isFindLastKey
protected boolean isFindLastKey ( KeyEvent e )
Checks if the key is used as a key to find the last occurence.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isFindNextKey
protected boolean isFindNextKey ( KeyEvent e )
Checks if the key is used as a key to find the next occurence.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isFindPreviousKey
protected boolean isFindPreviousKey ( KeyEvent e )
Checks if the key is used as a key to find the previous occurence.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isHeavyweightComponentEnabled
public boolean isHeavyweightComponentEnabled ( )
No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isIncrementalSelectKey
protected boolean isIncrementalSelectKey ( KeyEvent e )
Checks if the key will trigger incremental selection.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isNavigationKey
protected boolean isNavigationKey ( KeyEvent e )
Checks if the key is used as a navigation key. Navigation keys are keys which are used to navigate to other occurences of the searching string.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isPopupVisible
public boolean isPopupVisible ( )
Check if the searchable popup is visible.
Wiki javadoc Use textile entry format.
Add your comments here.
isRepeats
public boolean isRepeats ( )
Checks if restart from the beginning when searching reaches the end or restart from the end when reaches beginning. Default is false.
Wiki javadoc Use textile entry format.
Add your comments here.
isReverseOrder
public boolean isReverseOrder ( )
Checks the searching order. By default the searchable starts searching from top to bottom. If this flag is false, it searchs from bottom to top.
Wiki javadoc Use textile entry format.
Add your comments here.
isSelectAllKey
protected boolean isSelectAllKey ( KeyEvent e )
Checks if the key will trigger selecting all.
Parameters
TypeNameDescription
KeyEvent e No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
isWildcardEnabled
public boolean isWildcardEnabled ( )
Checks if it supports wildcard in searching text. By default it is true which means user can type in "*" or "?" to match with any charactors or any charactor. If it's false, it will treat "*" or "?" as a regular charactor.
Wiki javadoc Use textile entry format.
Add your comments here.
keyTypedOrPressed
protected void keyTypedOrPressed ( KeyEvent e )
This method is called when a key is typed or pressed.
Parameters
TypeNameDescription
KeyEvent e the KeyEvent.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
removePropertyChangeListener
public void removePropertyChangeListener ( PropertyChangeListener propertychangelistener )
Removes the property change listener.
Parameters
TypeNameDescription
PropertyChangeListener propertychangelistener No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
removeSearchableListener
public void removeSearchableListener ( SearchableListener l )
Removes the specified searchable listener so that it no longer receives searchable events.
Parameters
TypeNameDescription
SearchableListener l the searchable listener
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
reverseFindFromCursor
public int reverseFindFromCursor ( String s )
Finds the previous matching index from the cursor. If it reaches the beginning, it will restart from the end.
Parameters
TypeNameDescription
String s No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setBackground
public void setBackground ( Color background )
Sets the background color used by popup.
Parameters
TypeNameDescription
Color background No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setCaseSensitive
public void setCaseSensitive ( boolean caseSensitive )
Sets the case sensitive flag. By default, it's false meaning it's a case insensitive search.
Parameters
TypeNameDescription
boolean caseSensitive No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setCursor
public void setCursor ( int cursor )
Sets the cursor which is the index of current location when searching. The value will be used in findNext and findPrevious.
Parameters
TypeNameDescription
int cursor the new position of the cursor.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setForeground
public void setForeground ( Color foreground )
Sets the foreground color used by popup.
Parameters
TypeNameDescription
Color foreground No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setHeavyweightComponentEnabled
public void setHeavyweightComponentEnabled ( boolean heavyweightComponentEnabled )
No description provided.
Parameters
TypeNameDescription
boolean heavyweightComponentEnabled No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setMismatchForeground
public void setMismatchForeground ( Color mismatchForeground )
Sets the foreground for mismatch.
Parameters
TypeNameDescription
Color mismatchForeground No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setPopupLocation
public void setPopupLocation ( int popupLocation )
Sets the popup location.
Parameters
TypeNameDescription
int popupLocation the popup location. The valid values are either TOP or BOTTOM .
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setPopupLocationRelativeTo
public void setPopupLocationRelativeTo ( Component popupLocationRelativeTo )
Sets the location of the popup relative to the specified component. Then based on the value of getPopupLocation() . If you never set, we will use the searchable component or its scroll pane (if exists) as the popupLocationRelativeTo component.
Parameters
TypeNameDescription
Component popupLocationRelativeTo No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setRepeats
public void setRepeats ( boolean repeats )
Sets the repeat flag. By default, it's false meaning it will stop searching when reaching the end or reaching the beginning.
Parameters
TypeNameDescription
boolean repeats No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setReverseOrder
public void setReverseOrder ( boolean reverseOrder )
Sets the searching order. By default the searchable starts searching from top to bottom. If this flag is false, it searchs from bottom to top.
Parameters
TypeNameDescription
boolean reverseOrder No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setSearchableProvider
public void setSearchableProvider ( SearchableProvider searchableProvider )
No description provided.
Parameters
TypeNameDescription
SearchableProvider searchableProvider No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setSearchingDelay
public void setSearchingDelay ( int searchingDelay )
If this flag is set to a positive number, it will wait for that many ms before doing the search. When the searching is complex, this flag will be useful to make the searching efficient. In the other words, if user types in several keys very quickly, there will be only one search. If this flag is set to 0 or a negative number, each key will generate a search with no delay.
Parameters
TypeNameDescription
int searchingDelay the number of ms delay before searching start.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setSearchLabel
public void setSearchLabel ( String searchLabel )
Sets the text that appears in the search popup.
Parameters
TypeNameDescription
String searchLabel No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setSelectedIndex
protected void setSelectedIndex ( int index, boolean incremental )
Sets the selected index. The concrete implementation should call methods on the component to select the element at the specified index. The incremental flag is used to do multiple select. If the flag is true, the element at the index should be added to current selection. If false, you should clear previous selection and then select the element.
Parameters
TypeNameDescription
int index the index to be selected
boolean incremental a flag to enable multiple selection. If the flag is true, the element at the index should be added to current selection. If false, you should clear previous selection and then select the element.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setWildcardEnabled
public void setWildcardEnabled ( boolean wildcardEnabled )
Enable or disable the usage of wildcard.
Parameters
TypeNameDescription
boolean wildcardEnabled No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
showPopup
public void showPopup ( String searchingText )
Shows the search popup. By default, the search popup will be visible automatically when user types in the first key (in the case of JList, JTree, JTable) or types in designated keystroke (in the case of JTextComponent). So this method is only used when you want to show the popup manually.
Parameters
TypeNameDescription
String searchingText No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
uninstallListeners
public void uninstallListeners ( )
Uninstall the listeners that installed before. This method is never called because we don't have the control of the life cyle of the component. However you can call this method if you don't want the searchable component not searchable.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.