| |
|
| java.lang.Object com.jidesoft.swing.Searchable com.jidesoft.swing.ListSearchable
ListSearchable | public class ListSearchable extends Searchable implements ListDataListener,PropertyChangeListener(Code) | | ListSearchable is an concrete implementation of
Searchable that enables the search function in JList.
It's very simple to use it. Assuming you have a JList, all you need to do is to
call
JList list = ....;
ListSearchable searchable = new ListSearchable(list);
Now the JList will have the search function.
There is very little customization you need to do to ListSearchable. The only thing you might
need is when the element in the JList needs a special conversion to convert to string. If so, you can overide
convertElementToString() to provide you own algorithm to do the conversion.
JList list = ....;
ListSearchable searchable = new ListSearchable(list) {
protected String convertElementToString(Object object) {
...
}
};
Additional customization can be done on the base Searchable class such as background and foreground color, keystrokes,
case sensitivity.
|
convertElementToString | protected String convertElementToString(Object object)(Code) | | Converts the element in Jlist to string. The returned value will be the
toString() of whatever element that returned from list.getModel().getElementAt(i) .
Parameters: object - the string representing the element in the JList. |
getElementCount | protected int getElementCount()(Code) | | |
getSelectedIndex | protected int getSelectedIndex()(Code) | | |
setSelectedIndex | protected void setSelectedIndex(int index, boolean incremental)(Code) | | |
uninstallListeners | public void uninstallListeners()(Code) | | |
|
|
|