com.jidesoft.combobox
Class ListExComboBoxSearchable
java.lang.Object
com.jidesoft.swing.Searchable
com.jidesoft.swing.ComboBoxSearchable
com.jidesoft.combobox.ExComboBoxSearchable
com.jidesoft.combobox.ListExComboBoxSearchable
- All Implemented Interfaces:
- PropertyChangeListener, EventListener, ListDataListener, PopupMenuListener
public class ListExComboBoxSearchable
- extends ExComboBoxSearchable
ListSearchable
is an concrete implementation of Searchable
that enables the
search function in ListExComboBox.
It's very simple to use it. Assuming you have a JList, all you need to do is to
call
ListExComboBox ListExComboBox = ....;
ListExComboBoxSearchable searchable = new ListExComboBoxSearchable(ListExComboBox);
Now the ListExComboBox will have the search function.
There is very little customization you need to do to ListExComboBoxSearchable. The only thing you might need is when
the element in the ListExComboBox needs a special conversion to convert to string. If so, you can override
convertElementToString() to provide you own algorithm to do the conversion.
ListExComboBox ListExComboBox = ....;
ListExComboBoxSearchable searchable = new ListExComboBoxSearchable(ListExComboBox) {
protected String convertElementToString(Object object) {
...
}
};
Additional customization can be done on the base Searchable class such as background and foreground color,
keystrokes, case sensitivity.
Methods inherited from class com.jidesoft.swing.ComboBoxSearchable |
contentsChanged, getElementAt, getElementCount, getSelectedIndex, intervalAdded, intervalRemoved, isRefreshPopupDuringSearching, isShowPopupDuringSearching, popupMenuCanceled, popupMenuWillBecomeVisible, propertyChange, setRefreshPopupDuringSearching, setShowPopupDuringSearching, uninstallListeners |
Methods inherited from class com.jidesoft.swing.Searchable |
addPropertyChangeListener, addSearchableListener, adjustSelectedIndex, cancelHighlightAll, compare, compare, convertToString, createComponentListener, createKeyListener, createSearchPopup, findAll, findFirst, findFromCursor, findLast, findNext, findPrevious, firePropertyChangeEvent, fireSearchableEvent, getBackground, getComponent, getCurrentIndex, getCursor, getElementAtAsString, getForeground, getMismatchForeground, getPopupLocation, getPopupLocationRelativeTo, getPopupTimeout, getResourceString, getSearchable, getSearchableListeners, getSearchableProvider, getSearchingDelay, getSearchingText, getSearchLabel, getWildcardSupport, hidePopup, highlightAll, installListeners, isActivateKey, isCaseSensitive, isCountMatch, isDeactivateKey, isFindFirstKey, isFindLastKey, isFindNextKey, isFindPreviousKey, isFromStart, isHeavyweightComponentEnabled, isHideSearchPopupOnEvent, isIncrementalSelectKey, isNavigationKey, isPopupVisible, isProcessModelChangeEvent, isRepeats, isReverseOrder, isSearchableListenerInstalled, isSelectAllKey, isWildcardEnabled, keyTypedOrPressed, removePropertyChangeListener, removeSearchableListener, reverseFindFromCursor, searchingTextEmpty, select, setBackground, setCaseSensitive, setCountMatch, setCursor, setCursor, setForeground, setFromStart, setHeavyweightComponentEnabled, setHideSearchPopupOnEvent, setMismatchForeground, setPopupLocation, setPopupLocationRelativeTo, setPopupTimeout, setProcessModelChangeEvent, setRepeats, setReverseOrder, setSearchableProvider, setSearchingDelay, setSearchLabel, setWildcardEnabled, setWildcardSupport, textChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ListExComboBoxSearchable
public ListExComboBoxSearchable(ListExComboBox ListExComboBox)
ListExComboBoxSearchable
public ListExComboBoxSearchable(MultiSelectListExComboBox ListExComboBox)
createFocusListener
protected FocusListener createFocusListener()
- Description copied from class:
Searchable
- Creates a FocusListener. We use it to hide the popup when the component loses focus.
- Overrides:
createFocusListener
in class Searchable
- Returns:
- a FocusListener.
showPopup
public void showPopup(String searchingText)
- Description copied from class:
Searchable
- 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.
- Overrides:
showPopup
in class Searchable
- Parameters:
searchingText
- the searching text
setSelectedIndex
protected void setSelectedIndex(int index,
boolean incremental)
- Description copied from class:
Searchable
- 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.
- Overrides:
setSelectedIndex
in class ComboBoxSearchable
- Parameters:
index
- the index to be selectedincremental
- 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.