|
Swing 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPopupMenu | +--javax.swing.plaf.basic.BasicComboPopup
This is an implementation of the ComboPopup interface. It is primarily for use by BasicComboBoxUI and its subclasses. BasicComboPopup extends JPopupMenu because most combo boxes use a popup menu to display the list of possible selections. BasicComboBoxUI only requires a ComboPopup, so subclasses of BasicComboBoxUI aren't required to use this class. All event handling is handled by createxxxListener() methods and internal classes. You can change the behavior of this class by overriding the createxxxListener() methods and supplying your own event listeners or subclassing from the ones supplied in this class. Inner classes for handling events: InvocationMouseHandler InvocationMouseMotionHandler InvocationKeyHandler ListSelectionHandler ListDataHandler ListMouseHandler ListMouseMotionHandler PropertyChangeHandler ItemHandler
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Inner Class Summary | |
class |
BasicComboPopup.InvocationKeyHandler
This listener watches for the spacebar being pressed and shows/hides the popup accordingly. |
protected class |
BasicComboPopup.InvocationMouseHandler
This listener knows how and when to invoke this popup menu. |
protected class |
BasicComboPopup.InvocationMouseMotionHandler
This listener watches for dragging and updates the current selection in the list if it is dragging over the list. |
protected class |
BasicComboPopup.ItemHandler
This listener watches for changes in the JComboBox's selection. |
class |
BasicComboPopup.ListDataHandler
Keeps the selected index in the list in-sync with the combo box's selection. |
protected class |
BasicComboPopup.ListMouseHandler
This listener hides the popup when the mouse is released in the list. |
protected class |
BasicComboPopup.ListMouseMotionHandler
This listener changes the selected item as you move the mouse over the list. |
protected class |
BasicComboPopup.ListSelectionHandler
This listener watches for changes in the list's selection and reports them to the combo box. |
protected class |
BasicComboPopup.PropertyChangeHandler
This listener watches for bound property changes in JComboBox. |
Inner classes inherited from class javax.swing.JPopupMenu |
JPopupMenu.AccessibleJPopupMenu,
JPopupMenu.Separator |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary | |
protected Timer |
autoscrollTimer
|
protected JComboBox |
comboBox
|
protected boolean |
hasEntered
|
protected boolean |
isAutoScrolling
|
protected java.awt.event.ItemListener |
itemListener
|
protected java.awt.event.KeyListener |
keyListener
|
protected JList |
list
|
protected ListDataListener |
listDataListener
|
protected java.awt.event.MouseListener |
listMouseListener
|
protected java.awt.event.MouseMotionListener |
listMouseMotionListener
|
protected ListSelectionListener |
listSelectionListener
|
protected java.awt.event.MouseListener |
mouseListener
|
protected java.awt.event.MouseMotionListener |
mouseMotionListener
|
protected java.beans.PropertyChangeListener |
propertyChangeListener
|
protected static int |
SCROLL_DOWN
|
protected static int |
SCROLL_UP
|
protected int |
scrollDirection
|
protected JScrollPane |
scroller
|
protected boolean |
valueIsAdjusting
|
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
Constructor Summary | |
BasicComboPopup(JComboBox combo)
|
Method Summary | |
protected void |
autoScrollDown()
|
protected void |
autoScrollUp()
|
protected java.awt.Rectangle |
computePopupBounds(int px,
int py,
int pw,
int ph)
|
protected void |
configureList()
Called to configure the list created by createList(). |
protected void |
configurePopup()
Called to configure this JPopupMenu (BasicComboPopup is a JPopupMenu). |
protected void |
configureScroller()
Called to configure the JScrollPane created by createScroller(). |
protected java.awt.event.MouseEvent |
convertMouseEvent(java.awt.event.MouseEvent e)
|
protected java.awt.event.ItemListener |
createItemListener()
Creates an item listener that watches for changes in the selected item in the JComboBox. |
protected java.awt.event.KeyListener |
createKeyListener()
Creates the key listener that is returned by ComboPopup.getKeyListener(). |
protected JList |
createList()
Creates the JList that is used in the popup to display the items in the model. |
protected ListDataListener |
createListDataListener()
Creates a list data listener that watches for inserted and removed items from the combo box model. |
protected java.awt.event.MouseListener |
createListMouseListener()
Creates a mouse listener that watches for mouse events in the popup's list. |
protected java.awt.event.MouseMotionListener |
createListMouseMotionListener()
Creates a mouse motion listener that watches for mouse events in the popup's list. |
protected ListSelectionListener |
createListSelectionListener()
Creates a list selection listener that watches for selection changes in the popup's list. |
protected java.awt.event.MouseListener |
createMouseListener()
Creates the mouse listener that is returned by ComboPopup.getMouseListener(). |
protected java.awt.event.MouseMotionListener |
createMouseMotionListener()
Creates the mouse motion listener that is returned by ComboPopup.getMouseMotionListener(). |
protected java.beans.PropertyChangeListener |
createPropertyChangeListener()
Creates a property change listener that watches for changes in the bound properties in the JComboBox. |
protected JScrollPane |
createScroller()
Creates the JScrollPane that is used in the popup to hold the list. |
protected void |
delegateFocus(java.awt.event.MouseEvent e)
This is is a utility method that helps event handlers figure out where to send the focus when the popup is brought up. |
java.awt.event.KeyListener |
getKeyListener()
Implementation of ComboPopup.getKeyListener(). |
JList |
getList()
Implementation of ComboPopup.getList(). |
java.awt.event.MouseListener |
getMouseListener()
Implementation of ComboPopup.getMouseListener(). |
java.awt.event.MouseMotionListener |
getMouseMotionListener()
Implementation of ComboPopup.getMouseMotionListener(). |
protected int |
getPopupHeightForRowCount(int maxRowCount)
|
void |
hide()
Implementation of ComboPopup.hide(). |
protected void |
installComboBoxListeners()
This method adds the necessary listeners to the JComboBox. |
protected void |
installComboBoxModelListeners(ComboBoxModel model)
|
protected void |
installKeyboardActions()
|
protected void |
installListListeners()
Called by configureList() to add the necessary listeners to the list. |
boolean |
isFocusTraversable()
Overridden to unconditionally return false. |
void |
show()
Implementation of ComboPopup.show(). |
protected void |
startAutoScrolling(int direction)
Called by BasicComboPopup$InvocationMouseMotionHandler to handle auto- scrolling the list. |
protected void |
stopAutoScrolling()
|
protected void |
togglePopup()
Makes the popup visible if it is hidden and makes it hidden if it is visible. |
protected void |
uninstallComboBoxModelListeners(ComboBoxModel model)
|
void |
uninstallingUI()
Called when the UI is uninstalling. |
protected void |
uninstallKeyboardActions()
|
protected void |
updateListBoxSelectionForEvent(java.awt.event.MouseEvent anEvent,
boolean shouldScroll)
A utility method used by the event listeners. |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
removeAll,
removeContainerListener,
setLayout,
validate,
validateTree |
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
getBackground,
getBounds,
getColorModel,
getCursor,
getFont,
getFontMetrics,
getForeground,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
imageUpdate,
inside,
isEnabled,
isShowing,
isValid,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setBounds,
setCursor,
setLocale,
setLocation,
setName,
setSize,
setSize,
show,
size,
toString,
transferFocus |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected JComboBox comboBox
protected JList list
protected JScrollPane scroller
protected boolean valueIsAdjusting
protected java.awt.event.MouseMotionListener mouseMotionListener
protected java.awt.event.MouseListener mouseListener
protected java.awt.event.KeyListener keyListener
protected ListSelectionListener listSelectionListener
protected ListDataListener listDataListener
protected java.awt.event.MouseListener listMouseListener
protected java.awt.event.MouseMotionListener listMouseMotionListener
protected java.beans.PropertyChangeListener propertyChangeListener
protected java.awt.event.ItemListener itemListener
protected Timer autoscrollTimer
protected boolean hasEntered
protected boolean isAutoScrolling
protected int scrollDirection
protected static final int SCROLL_UP
protected static final int SCROLL_DOWN
Constructor Detail |
public BasicComboPopup(JComboBox combo)
Method Detail |
public void show()
public void hide()
public JList getList()
public java.awt.event.MouseListener getMouseListener()
public java.awt.event.MouseMotionListener getMouseMotionListener()
public java.awt.event.KeyListener getKeyListener()
public void uninstallingUI()
protected void uninstallComboBoxModelListeners(ComboBoxModel model)
protected void uninstallKeyboardActions()
protected java.awt.event.MouseListener createMouseListener()
protected java.awt.event.MouseMotionListener createMouseMotionListener()
protected java.awt.event.KeyListener createKeyListener()
protected ListSelectionListener createListSelectionListener()
protected ListDataListener createListDataListener()
protected java.awt.event.MouseListener createListMouseListener()
protected java.awt.event.MouseMotionListener createListMouseMotionListener()
protected java.beans.PropertyChangeListener createPropertyChangeListener()
protected java.awt.event.ItemListener createItemListener()
protected JList createList()
protected void configureList()
protected void installListListeners()
protected JScrollPane createScroller()
protected void configureScroller()
protected void configurePopup()
protected void installComboBoxListeners()
protected void installComboBoxModelListeners(ComboBoxModel model)
protected void installKeyboardActions()
public boolean isFocusTraversable()
protected void startAutoScrolling(int direction)
protected void stopAutoScrolling()
protected void autoScrollUp()
protected void autoScrollDown()
protected void delegateFocus(java.awt.event.MouseEvent e)
protected void togglePopup()
protected java.awt.event.MouseEvent convertMouseEvent(java.awt.event.MouseEvent e)
protected int getPopupHeightForRowCount(int maxRowCount)
protected java.awt.Rectangle computePopupBounds(int px, int py, int pw, int ph)
protected void updateListBoxSelectionForEvent(java.awt.event.MouseEvent anEvent, boolean shouldScroll)
|
Swing 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |