public class BasicComboPopup extends JPopupMenuimplements ComboPopup
ComboPopup interface. This class represents the ui for the popup portion of the combo box.
All event handling is handled by listener classes created with the 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.
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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.
| Modifier and Type | Class and Description |
|---|---|
class |
BasicComboPopup
As of Java 2 platform v 1.4, this class is now obsolete and is only included for backwards API compatibility.
|
protected class |
BasicComboPopup
A listener to be registered upon the combo box (
not its popup menu) to handle mouse events that affect the state of the popup menu.
|
protected class |
BasicComboPopup
This listener watches for dragging and updates the current selection in the list if it is dragging over the list.
|
protected class |
BasicComboPopup
This listener watches for changes to the selection in the combo box.
|
class |
BasicComboPopup
As of 1.4, this class is now obsolete, doesn't do anything, and is only included for backwards API compatibility.
|
protected class |
BasicComboPopup
This listener hides the popup when the mouse is released in the list.
|
protected class |
BasicComboPopup
This listener changes the selected item as you move the mouse over the list.
|
protected class |
BasicComboPopup
As of Java 2 platform v 1.4, this class is now obsolete, doesn't do anything, and is only included for backwards API compatibility.
|
protected class |
BasicComboPopup
This listener watches for bound properties that have changed in the combo box.
|
JPopupMenu.AccessibleJPopupMenu , JPopupMenu.Separator JComponent.AccessibleJComponent Container.AccessibleAWTContainer Component.AccessibleAWTComponent , Component.BaselineResizeBehavior , Component.BltBufferStrategy , Component.FlipBufferStrategy | Modifier and Type | Field and Description |
|---|---|
protected Timer |
autoscrollTimer
This protected field is implementation specific.
|
protected JComboBox |
comboBox
|
protected boolean |
hasEntered
|
protected boolean |
isAutoScrolling
|
protected ItemListener |
itemListener
This protected field is implementation specific.
|
protected KeyListener |
keyListener
This protected field is implementation specific.
|
protected JList |
list
This protected field is implementation specific.
|
protected ListDataListener |
listDataListener
This protected field is implementation specific.
|
protected MouseListener |
listMouseListener
This protected field is implementation specific.
|
protected MouseMotionListener |
listMouseMotionListener
This protected field is implementation specific.
|
protected ListSelectionListener |
listSelectionListener
This protected field is implementation specific.
|
protected MouseListener |
mouseListener
This protected field is implementation specific.
|
protected MouseMotionListener |
mouseMotionListener
This protected field is implementation specific.
|
protected PropertyChangeListener |
propertyChangeListener
This protected field is implementation specific.
|
protected static int |
SCROLL_DOWN
|
protected static int |
SCROLL_UP
|
protected int |
scrollDirection
|
protected JScrollPane |
scroller
This protected field is implementation specific.
|
protected boolean |
valueIsAdjusting
As of Java 2 platform v1.4 this previously undocumented field is no longer used.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
BasicComboPopup(JComboBox
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
autoScrollDown()
This protected method is implementation specific and should be private.
|
protected void |
autoScrollUp()
This protected method is implementation specific and should be private.
|
protected Rectangle |
computePopupBounds(int px, int py, int pw, int ph)
Calculate the placement and size of the popup portion of the combo box based on the combo box location and the enclosing screen bounds.
|
protected void |
configureList()
Configures the list which is used to hold the combo box items in the popup.
|
protected void |
configurePopup()
Configures the popup portion of the combo box.
|
protected void |
configureScroller()
Configures the scrollable portion which holds the list within the combo box popup.
|
protected MouseEvent |
convertMouseEvent(MouseEvent
|
protected ItemListener |
createItemListener()
Creates an
ItemListener which will be added to the combo box.
|
protected KeyListener |
createKeyListener()
Creates the key listener that will be added to the combo box.
|
protected JList |
createList()
Creates the JList used in the popup to display the items in the combo box model.
|
protected ListDataListener |
createListDataListener()
Creates a list data listener which will be added to the
ComboBoxModel.
|
protected MouseListener |
createListMouseListener()
Creates a mouse listener that watches for mouse events in the popup's list.
|
protected MouseMotionListener |
createListMouseMotionListener()
Creates a mouse motion listener that watches for mouse motion 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 MouseListener |
createMouseListener()
Creates a listener that will watch for mouse-press and release events on the combo box.
|
protected MouseMotionListener |
createMouseMotionListener()
Creates the mouse motion listener which will be added to the combo box.
|
protected PropertyChangeListener |
createPropertyChangeListener()
Creates a
PropertyChangeListener which will be added to the combo box.
|
protected JScrollPane |
createScroller()
Creates the scroll pane which houses the scrollable list.
|
protected void |
delegateFocus(MouseEvent
This is is a utility method that helps event handlers figure out where to send the focus when the popup is brought up.
|
protected void |
firePopupMenuCanceled()
Notifies
PopupMenuListeners that this popup menu is cancelled.
|
protected void |
firePopupMenuWillBecomeInvisible()
Notifies
PopupMenuListeners that this popup menu will become invisible.
|
protected void |
firePopupMenuWillBecomeVisible()
Notifies
PopupMenuListeners that this popup menu will become visible.
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this BasicComboPopup.
|
KeyListener |
getKeyListener()
Implementation of ComboPopup.getKeyListener().
|
JList |
getList()
Implementation of ComboPopup.getList().
|
MouseListener |
getMouseListener()
Implementation of ComboPopup.getMouseListener().
|
MouseMotionListener |
getMouseMotionListener()
Implementation of ComboPopup.getMouseMotionListener().
|
protected int |
getPopupHeightForRowCount(int maxRowCount)
Retrieves the height of the popup based on the current ListCellRenderer and the maximum row count.
|
void |
hide()
Implementation of ComboPopup.hide().
|
protected void |
installComboBoxListeners()
This method adds the necessary listeners to the JComboBox.
|
protected void |
installComboBoxModelListeners(ComboBoxModel
Installs the listeners on the combo box model.
|
protected void |
installKeyboardActions()
|
protected void |
installListListeners()
Adds the listeners to the list control.
|
boolean |
isFocusTraversable()
Overridden to unconditionally return false.
|
void |
show()
Implementation of ComboPopup.show().
|
protected void |
startAutoScrolling(int direction)
This protected method is implementation specific and should be private.
|
protected void |
stopAutoScrolling()
This protected method is implementation specific and should be private.
|
protected void |
togglePopup()
Makes the popup visible if it is hidden and makes it hidden if it is visible.
|
protected void |
uninstallComboBoxModelListeners(ComboBoxModel
Removes the listeners from the combo box model
|
void |
uninstallingUI()
Called when the UI is uninstalling.
|
protected void |
uninstallKeyboardActions()
|
protected void |
updateListBoxSelectionForEvent(MouseEvent
A utility method used by the event listeners.
|
add, add, add, addMenuKeyListener, addPopupMenuListener, addSeparator, createActionChangeListener, createActionComponent, getComponent, getComponentAtIndex, getComponentIndex, getDefaultLightWeightPopupEnabled, getInvoker, getLabel, getMargin, getMenuKeyListeners, getPopupMenuListeners, getSelectionModel, getSubElements, getUI, getUIClassID, insert, insert, isBorderPainted, isLightWeightPopupEnabled, isPopupTrigger, isVisible, menuSelectionChanged, pack, paintBorder, paramString, processFocusEvent, processKeyEvent, processKeyEvent, processMouseEvent, remove, removeMenuKeyListener, removePopupMenuListener, setBorderPainted, setDefaultLightWeightPopupEnabled, setInvoker, setLabel, setLightWeightPopupEnabled, setLocation, setPopupSize, setPopupSize, setSelected, setSelectionModel, setUI, setVisible, show, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisVisibleprotected JComboBoxcomboBox
protected JListlist
getList(),
createList()
protected JScrollPanescroller
createScroller()
protected boolean valueIsAdjusting
protected MouseMotionListenermouseMotionListener
protected MouseListenermouseListener
getMouseListener(),
createMouseListener()
protected KeyListenerkeyListener
getKeyListener(),
createKeyListener()
protected ListSelectionListenerlistSelectionListener
createListSelectionListener()
protected MouseListenerlistMouseListener
createListMouseListener()
protected MouseMotionListenerlistMouseMotionListener
createListMouseMotionListener()
protected PropertyChangeListenerpropertyChangeListener
createPropertyChangeListener()
protected ListDataListenerlistDataListener
createListDataListener()
protected ItemListeneritemListener
createItemListener()
protected TimerautoscrollTimer
protected boolean hasEntered
protected boolean isAutoScrolling
protected int scrollDirection
protected static final int SCROLL_UP
protected static final int SCROLL_DOWN
public BasicComboPopup(JComboBoxcombo)
public void show()
public void hide()
public JListgetList()
public MouseListenergetMouseListener()
getMouseListener in interface
ComboPopup
MouseListener or null
ComboPopup.getMouseListener()
public MouseMotionListenergetMouseMotionListener()
getMouseMotionListener in interface
ComboPopup
MouseMotionListener or null
ComboPopup.getMouseMotionListener()
public KeyListenergetKeyListener()
getKeyListener in interface
ComboPopup
KeyListener or null
ComboPopup.getKeyListener()
public void uninstallingUI()
protected void uninstallComboBoxModelListeners(ComboBoxModelmodel)
model - The combo box model to install listeners
installComboBoxModelListeners(javax.swing.ComboBoxModel)
protected void uninstallKeyboardActions()
protected void firePopupMenuWillBecomeVisible()
JPopupMenu
PopupMenuListeners that this popup menu will become visible.
protected void firePopupMenuWillBecomeInvisible()
JPopupMenu
PopupMenuListeners that this popup menu will become invisible.
protected void firePopupMenuCanceled()
JPopupMenu
PopupMenuListeners that this popup menu is cancelled.
protected MouseListenercreateMouseListener()
MouseListener which will be added to the combo box or null
protected MouseMotionListenercreateMouseMotionListener()
MouseMotionListener which will be added to the combo box or null
protected KeyListenercreateKeyListener()
KeyListener or null
protected ListSelectionListenercreateListSelectionListener()
ListSelectionListener or null
protected ListDataListenercreateListDataListener()
ComboBoxModel. If this method returns null then it will not be added to the combo box model.
ListDataListener or null
protected MouseListenercreateListMouseListener()
MouseListener or null
protected MouseMotionListenercreateListMouseMotionListener()
MouseMotionListener or null
protected PropertyChangeListenercreatePropertyChangeListener()
PropertyChangeListener which will be added to the combo box. If this method returns null then it will not be added to the combo box.
PropertyChangeListener or null
protected ItemListenercreateItemListener()
ItemListener which will be added to the combo box. If this method returns null then it will not be added to the combo box.
Subclasses may override this method to return instances of their own ItemEvent handlers.
ItemListener or null
protected JListcreateList()
JList used to display the combo box items
protected void configureList()
createList()
protected void installListListeners()
protected JScrollPanecreateScroller()
protected void configureScroller()
protected void configurePopup()
protected void installComboBoxListeners()
protected void installComboBoxModelListeners(ComboBoxModelmodel)
uninstallComboBoxModelListeners.
model - The combo box model to install listeners
uninstallComboBoxModelListeners(javax.swing.ComboBoxModel)
protected void installKeyboardActions()
public boolean isFocusTraversable()
isFocusTraversable in class
Component
true if this
Component is focusable;
false otherwise
Component.setFocusable(boolean)
protected void startAutoScrolling(int direction)
protected void stopAutoScrolling()
protected void autoScrollUp()
protected void autoScrollDown()
public AccessibleContextgetAccessibleContext()
getAccessibleContext in interface
Accessible
getAccessibleContext in class
JPopupMenu
protected void delegateFocus(MouseEvente)
protected void togglePopup()
protected MouseEventconvertMouseEvent(MouseEvent e)
protected int getPopupHeightForRowCount(int maxRowCount)
protected RectanglecomputePopupBounds(int px, int py, int pw, int ph)
px - starting x location
py - starting y location
pw - starting width
ph - starting height
protected void updateListBoxSelectionForEvent(MouseEventanEvent, boolean shouldScroll)