| |
|
| java.lang.Object com.jidesoft.swing.Searchable com.jidesoft.swing.ComboBoxSearchable
ComboBoxSearchable | public class ComboBoxSearchable extends Searchable implements ListDataListener,PropertyChangeListener(Code) | | ComboBoxSearchable is an concrete implementation of
Searchable that enables the search function in non-editable JComboBox.
It's very simple to use it. Assuming you have a JComboBox, all you need to do is to
call
JComboBox comboBox = ....;
ComboBoxSearchable searchable = new ComboBoxSearchable(comboBox);
Now the JComboBox will have the search function.
There is very little customization you need to do to ComboBoxSearchable. The only thing you might
need is when the element in the JComboBox needs a special conversion to convert to string. If so, you can overide
convertElementToString() to provide you own algorithm to do the conversion.
JComboBox comboBox = ....;
ComboBoxSearchable searchable = new ComboBoxSearchable(comboBox) {
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 Jcombobox 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 JComboBox. |
getElementCount | protected int getElementCount()(Code) | | |
getSelectedIndex | protected int getSelectedIndex()(Code) | | |
isShowPopupDuringSearching | public boolean isShowPopupDuringSearching()(Code) | | Checks if the popup is showing during searching.
true if popup is visible during searching. |
setSelectedIndex | protected void setSelectedIndex(int index, boolean incremental)(Code) | | |
setShowPopupDuringSearching | public void setShowPopupDuringSearching(boolean showPopupDuringSearching)(Code) | | Sets the property which determines if the popup should be shown during searching.
Parameters: showPopupDuringSearching - |
uninstallListeners | public void uninstallListeners()(Code) | | |
|
|
|