|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectswingwt.awt.Component
swingwt.awt.Container
swingwtx.swing.JComponent
swingwtx.swing.JPanel
swingwtx.custom.JLookupPopup
Very similar to JComboBox, this component is an uneditable text field with a button instead to popup a list of selectable items. A field at the top of the popup allows text searching. In addition, hotkeys in the text field allow searching like a combo box. I have designed this as a fast alternative for JComboBox as I discovered JComboBox performs very poorly under Linux/GTK2 with 200+ objects
Nested Class Summary |
Nested classes inherited from class swingwtx.swing.JComponent |
JComponent.InternalFrameSelectionListener |
Field Summary | |
protected JButton |
button
|
protected static int |
CANCELED
|
protected static int |
INVISIBLE
|
protected java.util.Vector |
itemListeners
Item events |
protected java.util.Vector |
items
The list of selectable objects |
protected java.util.Vector |
popupListeners
Popup menu events |
protected int |
selectedIndex
|
protected JTextField |
text
|
protected static int |
VISIBLE
|
Fields inherited from class swingwtx.swing.JPanel |
opaque, ppeer |
Fields inherited from class swingwtx.swing.JComponent |
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap |
Fields inherited from class swingwt.awt.Container |
composite, comps, containerListeners, layout, queuedValidateRequest |
Fields inherited from interface swingwt.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JLookupPopup()
Creates a new JLookupPopup |
Method Summary | |
void |
addFocusListener(FocusListener l)
Add a KeyListener to this component |
void |
addItem(java.lang.Object item)
Add a selection to the list |
void |
addItemListener(ItemListener l)
|
void |
addKeyListener(KeyListener l)
Add a KeyListener to this component |
void |
addPopupMenuListener(PopupMenuListener l)
|
protected void |
alphaSearchItem(char cs)
Performs an alpha search for the next item based on the key pressed |
protected void |
buttonPressed()
Gets called when the user presses the button. |
java.lang.Object |
getItemAt(int index)
Returns the item at a given position |
int |
getItemCount()
Returns the number of items in the list |
JTextField |
getJTextField()
|
int |
getSelectedIndex()
Returns the selected item by it's index |
java.lang.Object |
getSelectedItem()
Returns the selected item |
java.lang.String |
getToolTipText()
Returns the tooltip text for the component |
void |
grabFocus()
Forces keyboard focus to the component |
boolean |
isEnabled()
Returns true if the lookup is enabled |
protected void |
nextItem()
|
protected void |
previousItem()
|
void |
processItemEvent(ItemEvent e)
|
void |
processPopupMenuEvent(int id)
|
void |
removeAllItems()
Clears the list |
void |
removeFocusListener(FocusListener l)
Remove an KeyListener from the component |
void |
removeItem(java.lang.Object item)
Remove a selection from the list |
void |
removeItemListener(ItemListener l)
|
void |
removeKeyListener(KeyListener l)
Remove an KeyListener from the component |
void |
removePopupMenuListener(PopupMenuListener l)
|
void |
requestFocus()
Requests the component receives the focus |
void |
setEnabled(boolean b)
Sets whether the lookup is enabled |
void |
setMaximumRowCount(int i)
We don't care for this component - it just keeps compatibility with JComboBox |
void |
setSelectedIndex(int i)
Sets the selected item in the list |
void |
setSelectedItem(java.lang.Object o)
Sets the selected item |
void |
setToolTipText(java.lang.String tip)
Sets the tooltiptext for the component |
Methods inherited from class swingwtx.swing.JPanel |
calculatePreferredSize, getHeight, getSize, getWidth, setBorder, setSwingWTParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Vector items
protected java.util.Vector popupListeners
protected java.util.Vector itemListeners
protected JTextField text
protected JButton button
protected int selectedIndex
protected static final int CANCELED
protected static final int INVISIBLE
protected static final int VISIBLE
Constructor Detail |
public JLookupPopup()
Method Detail |
public void addFocusListener(FocusListener l)
Component
KeyListener
to this component
addFocusListener
in class Component
public void removeFocusListener(FocusListener l)
Component
KeyListener
from the component
removeFocusListener
in class Component
public void addKeyListener(KeyListener l)
Component
KeyListener
to this component
addKeyListener
in class Component
public void removeKeyListener(KeyListener l)
Component
KeyListener
from the component
removeKeyListener
in class Component
public void addPopupMenuListener(PopupMenuListener l)
public void removePopupMenuListener(PopupMenuListener l)
public void addItemListener(ItemListener l)
public void removeItemListener(ItemListener l)
public void processPopupMenuEvent(int id)
public void processItemEvent(ItemEvent e)
public void addItem(java.lang.Object item)
public void removeItem(java.lang.Object item)
public int getSelectedIndex()
public void setSelectedIndex(int i)
public void setSelectedItem(java.lang.Object o)
public java.lang.Object getSelectedItem()
public int getItemCount()
public java.lang.Object getItemAt(int index)
public void removeAllItems()
public void setEnabled(boolean b)
setEnabled
in class Component
public boolean isEnabled()
isEnabled
in class Component
public java.lang.String getToolTipText()
getToolTipText
in class Component
public void setToolTipText(java.lang.String tip)
setToolTipText
in class Component
public void setMaximumRowCount(int i)
protected void buttonPressed()
protected void previousItem()
protected void nextItem()
protected void alphaSearchItem(char cs)
public void requestFocus()
Component
requestFocus
in class Component
public void grabFocus()
Component
grabFocus
in class Component
public JTextField getJTextField()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |