|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.swing.Searchable
com.jidesoft.swing.ComboBoxSearchable
public class ComboBoxSearchable
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
Now the JComboBox will have the search function.
JComboBox comboBox = ....;
ComboBoxSearchable searchable = new ComboBoxSearchable(comboBox);
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,
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.jidesoft.swing.Searchable |
|---|
Searchable.SearchField, Searchable.SearchPopup |
| Field Summary |
|---|
| Fields inherited from class com.jidesoft.swing.Searchable |
|---|
_component, _componentListener, _focusListener, _keyListener, _matchCount, CLIENT_PROPERTY_SEARCHABLE, listenerList, PROPERTY_SEARCH_TEXT |
| Constructor Summary | |
|---|---|
ComboBoxSearchable(JComboBox comboBox)
|
|
| Method Summary | |
|---|---|
void |
contentsChanged(ListDataEvent e)
|
protected String |
convertElementToString(Object object)
Converts the element in JCombobox to string. |
protected Object |
getElementAt(int index)
Gets the element at the specified index. |
protected int |
getElementCount()
Gets the total element count in the component. |
protected int |
getSelectedIndex()
Gets the selected index in the component. |
void |
intervalAdded(ListDataEvent e)
|
void |
intervalRemoved(ListDataEvent e)
|
boolean |
isRefreshPopupDuringSearching()
Checks if the popup should be refreshed during searching. |
boolean |
isShowPopupDuringSearching()
Checks if the popup is showing during searching. |
void |
popupMenuCanceled(PopupMenuEvent e)
|
void |
popupMenuWillBecomeInvisible(PopupMenuEvent e)
|
void |
popupMenuWillBecomeVisible(PopupMenuEvent e)
|
void |
propertyChange(PropertyChangeEvent evt)
|
void |
setRefreshPopupDuringSearching(boolean refreshPopupDuringSearching)
Sets the property which determines if the popup should be refreshed during searching. |
protected void |
setSelectedIndex(int index,
boolean incremental)
Sets the selected index. |
void |
setShowPopupDuringSearching(boolean showPopupDuringSearching)
Sets the property which determines if the popup should be shown during searching. |
void |
uninstallListeners()
Uninstall the listeners that installed before. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ComboBoxSearchable(JComboBox comboBox)
| Method Detail |
|---|
public void uninstallListeners()
Searchable
uninstallListeners in class Searchablepublic boolean isShowPopupDuringSearching()
public void setShowPopupDuringSearching(boolean showPopupDuringSearching)
showPopupDuringSearching - the flag indicating if we should show popup during searchingpublic boolean isRefreshPopupDuringSearching()
public void setRefreshPopupDuringSearching(boolean refreshPopupDuringSearching)
refreshPopupDuringSearching - the flag indicating if we should refresh popup during searching
protected void setSelectedIndex(int index,
boolean incremental)
Searchable
setSelectedIndex in class Searchableindex - 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.protected int getSelectedIndex()
SearchableHere 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 selection 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).
getSelectedIndex in class Searchableprotected Object getElementAt(int index)
Searchable
getElementAt in class Searchableindex - the index
protected int getElementCount()
Searchable
getElementCount in class Searchableprotected String convertElementToString(Object object)
toString() of whatever
element that returned from list.getModel().getElementAt(i).
convertElementToString in class Searchableobject - the object to be converted
public void contentsChanged(ListDataEvent e)
contentsChanged in interface ListDataListenerpublic void intervalAdded(ListDataEvent e)
intervalAdded in interface ListDataListenerpublic void intervalRemoved(ListDataEvent e)
intervalRemoved in interface ListDataListenerpublic void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListenerpublic void popupMenuWillBecomeVisible(PopupMenuEvent e)
popupMenuWillBecomeVisible in interface PopupMenuListenerpublic void popupMenuWillBecomeInvisible(PopupMenuEvent e)
popupMenuWillBecomeInvisible in interface PopupMenuListenerpublic void popupMenuCanceled(PopupMenuEvent e)
popupMenuCanceled in interface PopupMenuListener
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||