BasicComboPopup (Java 2 Platform SE 5.0) (original) (raw)
javax.swing.plaf.basic
Class BasicComboPopup
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPopupMenu
javax.swing.plaf.basic.BasicComboPopup
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, MenuElement, ComboPopup
Direct Known Subclasses:
MetalComboBoxUI.MetalComboPopup
public class BasicComboPopup
extends JPopupMenu
implements ComboPopup
This is a basic implementation of the 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 thecreatexxxListener()
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 JavaBeansTM has been added to the java.beans
package. Please see XMLEncoder.
Nested Class Summary | |
---|---|
class | BasicComboPopup.InvocationKeyHandler As of Java 2 platform v 1.4, this class is now obsolete and is only included for backwards API compatibility. |
protected class | BasicComboPopup.InvocationMouseHandler 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.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 to the selection in the combo box. |
class | BasicComboPopup.ListDataHandler As of 1.4, this class is now obsolete, doesn't do anything, and is only included for backwards API compatibility. |
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 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.PropertyChangeHandler This listener watches for bound properties that have changed in the combo box. |
Nested classes/interfaces inherited from class javax.swing.JPopupMenu |
---|
JPopupMenu.AccessibleJPopupMenu, JPopupMenu.Separator |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
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. |
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 |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary |
---|
BasicComboPopup(JComboBox combo) |
Method Summary | |
---|---|
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](../../../../javax/swing/plaf/basic/BasicComboPopup.html#computePopupBounds%28int, int, int, int%29)(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 e) |
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 theComboBoxModel. |
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 e) 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 model) 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 model) Removes the listeners from the combo box model |
void | uninstallingUI() Called when the UI is uninstalling. |
protected void | uninstallKeyboardActions() |
protected void | [updateListBoxSelectionForEvent](../../../../javax/swing/plaf/basic/BasicComboPopup.html#updateListBoxSelectionForEvent%28java.awt.event.MouseEvent, boolean%29)(MouseEvent anEvent, boolean shouldScroll) A utility method used by the event listeners. |
Methods inherited from class javax.swing.JPopupMenu |
---|
add, add, add, addMenuKeyListener, addPopupMenuListener, addSeparator, createActionChangeListener, createActionComponent, getComponent, getComponentAtIndex, getComponentIndex, getDefaultLightWeightPopupEnabled, getInvoker, getLabel, getMargin, getMenuKeyListeners, getPopupMenuListeners, getSelectionModel, getSubElements, getUI, getUIClassID, [insert](../../../../javax/swing/JPopupMenu.html#insert%28javax.swing.Action, int%29), [insert](../../../../javax/swing/JPopupMenu.html#insert%28java.awt.Component, int%29), isBorderPainted, isLightWeightPopupEnabled, isPopupTrigger, isVisible, menuSelectionChanged, pack, paintBorder, paramString, processFocusEvent, processKeyEvent, [processKeyEvent](../../../../javax/swing/JPopupMenu.html#processKeyEvent%28java.awt.event.KeyEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager%29), [processMouseEvent](../../../../javax/swing/JPopupMenu.html#processMouseEvent%28java.awt.event.MouseEvent, javax.swing.MenuElement[], javax.swing.MenuSelectionManager%29), remove, removeMenuKeyListener, removePopupMenuListener, setBorderPainted, setDefaultLightWeightPopupEnabled, setInvoker, setLabel, setLightWeightPopupEnabled, [setLocation](../../../../javax/swing/JPopupMenu.html#setLocation%28int, int%29), setPopupSize, [setPopupSize](../../../../javax/swing/JPopupMenu.html#setPopupSize%28int, int%29), setSelected, setSelectionModel, setUI, setVisible, [show](../../../../javax/swing/JPopupMenu.html#show%28java.awt.Component, int, int%29), updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, [contains](../../../../javax/swing/JComponent.html#contains%28int, int%29), createToolTip, disable, enable, [firePropertyChange](../../../../javax/swing/JComponent.html#firePropertyChange%28java.lang.String, boolean, boolean%29), [firePropertyChange](../../../../javax/swing/JComponent.html#firePropertyChange%28java.lang.String, char, char%29), [firePropertyChange](../../../../javax/swing/JComponent.html#firePropertyChange%28java.lang.String, int, int%29), [fireVetoableChange](../../../../javax/swing/JComponent.html#fireVetoableChange%28java.lang.String, java.lang.Object, java.lang.Object%29), getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, [paintImmediately](../../../../javax/swing/JComponent.html#paintImmediately%28int, int, int, int%29), paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, [processKeyBinding](../../../../javax/swing/JComponent.html#processKeyBinding%28javax.swing.KeyStroke, java.awt.event.KeyEvent, int, boolean%29), processMouseEvent, processMouseMotionEvent, [putClientProperty](../../../../javax/swing/JComponent.html#putClientProperty%28java.lang.Object, java.lang.Object%29), [registerKeyboardAction](../../../../javax/swing/JComponent.html#registerKeyboardAction%28java.awt.event.ActionListener, javax.swing.KeyStroke, int%29), [registerKeyboardAction](../../../../javax/swing/JComponent.html#registerKeyboardAction%28java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int%29), removeAncestorListener, removeNotify, removeVetoableChangeListener, [repaint](../../../../javax/swing/JComponent.html#repaint%28long, int, int, int, int%29), repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, [reshape](../../../../javax/swing/JComponent.html#reshape%28int, int, int, int%29), revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, [setFocusTraversalKeys](../../../../javax/swing/JComponent.html#setFocusTraversalKeys%28int, java.util.Set%29), setFont, setForeground, setInheritsPopupMenu, [setInputMap](../../../../javax/swing/JComponent.html#setInputMap%28int, javax.swing.InputMap%29), setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, [add](../../../../java/awt/Container.html#add%28java.awt.Component, int%29), [add](../../../../java/awt/Container.html#add%28java.awt.Component, java.lang.Object%29), [add](../../../../java/awt/Container.html#add%28java.awt.Component, java.lang.Object, int%29), [add](../../../../java/awt/Container.html#add%28java.lang.String, java.awt.Component%29), addContainerListener, [addImpl](../../../../java/awt/Container.html#addImpl%28java.awt.Component, java.lang.Object, int%29), addPropertyChangeListener, [addPropertyChangeListener](../../../../java/awt/Container.html#addPropertyChangeListener%28java.lang.String, java.beans.PropertyChangeListener%29), applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, [findComponentAt](../../../../java/awt/Container.html#findComponentAt%28int, int%29), findComponentAt, getComponent, [getComponentAt](../../../../java/awt/Container.html#getComponentAt%28int, int%29), getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, [list](../../../../java/awt/Container.html#list%28java.io.PrintStream, int%29), [list](../../../../java/awt/Container.html#list%28java.io.PrintWriter, int%29), [locate](../../../../java/awt/Container.html#locate%28int, int%29), minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, [setComponentZOrder](../../../../java/awt/Container.html#setComponentZOrder%28java.awt.Component, int%29), setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
[action](../../../../java/awt/Component.html#action%28java.awt.Event, java.lang.Object%29), add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, [checkImage](../../../../java/awt/Component.html#checkImage%28java.awt.Image, java.awt.image.ImageObserver%29), [checkImage](../../../../java/awt/Component.html#checkImage%28java.awt.Image, int, int, java.awt.image.ImageObserver%29), [coalesceEvents](../../../../java/awt/Component.html#coalesceEvents%28java.awt.AWTEvent, java.awt.AWTEvent%29), contains, createImage, [createImage](../../../../java/awt/Component.html#createImage%28int, int%29), [createVolatileImage](../../../../java/awt/Component.html#createVolatileImage%28int, int%29), [createVolatileImage](../../../../java/awt/Component.html#createVolatileImage%28int, int, java.awt.ImageCapabilities%29), disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, byte, byte%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, double, double%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, float, float%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, long, long%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, java.lang.Object, java.lang.Object%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, short, short%29), 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](../../../../java/awt/Component.html#gotFocus%28java.awt.Event, java.lang.Object%29), handleEvent, hasFocus, [imageUpdate](../../../../java/awt/Component.html#imageUpdate%28java.awt.Image, int, int, int, int, int%29), [inside](../../../../java/awt/Component.html#inside%28int, int%29), isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, [keyDown](../../../../java/awt/Component.html#keyDown%28java.awt.Event, int%29), [keyUp](../../../../java/awt/Component.html#keyUp%28java.awt.Event, int%29), list, list, list, location, [lostFocus](../../../../java/awt/Component.html#lostFocus%28java.awt.Event, java.lang.Object%29), [mouseDown](../../../../java/awt/Component.html#mouseDown%28java.awt.Event, int, int%29), [mouseDrag](../../../../java/awt/Component.html#mouseDrag%28java.awt.Event, int, int%29), [mouseEnter](../../../../java/awt/Component.html#mouseEnter%28java.awt.Event, int, int%29), [mouseExit](../../../../java/awt/Component.html#mouseExit%28java.awt.Event, int, int%29), [mouseMove](../../../../java/awt/Component.html#mouseMove%28java.awt.Event, int, int%29), [mouseUp](../../../../java/awt/Component.html#mouseUp%28java.awt.Event, int, int%29), [move](../../../../java/awt/Component.html#move%28int, int%29), nextFocus, paintAll, postEvent, [prepareImage](../../../../java/awt/Component.html#prepareImage%28java.awt.Image, java.awt.image.ImageObserver%29), [prepareImage](../../../../java/awt/Component.html#prepareImage%28java.awt.Image, int, int, java.awt.image.ImageObserver%29), processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, [removePropertyChangeListener](../../../../java/awt/Component.html#removePropertyChangeListener%28java.lang.String, java.beans.PropertyChangeListener%29), repaint, [repaint](../../../../java/awt/Component.html#repaint%28int, int, int, int%29), repaint, resize, [resize](../../../../java/awt/Component.html#resize%28int, int%29), [setBounds](../../../../java/awt/Component.html#setBounds%28int, int, int, int%29), setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setName, setSize, [setSize](../../../../java/awt/Component.html#setSize%28int, int%29), show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, [wait](../../../../java/lang/Object.html#wait%28long, int%29) |
Methods inherited from interface javax.swing.plaf.basic.ComboPopup |
---|
isVisible |
Field Detail |
---|
comboBox
protected JComboBox comboBox
list
protected JList list
This protected field is implementation specific. Do not access directly or override. Use the accessor methods instead.
See Also:
scroller
protected JScrollPane scroller
This protected field is implementation specific. Do not access directly or override. Use the create method instead
See Also:
valueIsAdjusting
protected boolean valueIsAdjusting
As of Java 2 platform v1.4 this previously undocumented field is no longer used.
mouseMotionListener
protected MouseMotionListener mouseMotionListener
This protected field is implementation specific. Do not access directly or override. Use the accessor or create methods instead.
See Also:
getMouseMotionListener(), createMouseMotionListener()
mouseListener
protected MouseListener mouseListener
This protected field is implementation specific. Do not access directly or override. Use the accessor or create methods instead.
See Also:
getMouseListener(), createMouseListener()
keyListener
protected KeyListener keyListener
This protected field is implementation specific. Do not access directly or override. Use the accessor or create methods instead.
See Also:
getKeyListener(), createKeyListener()
listSelectionListener
protected ListSelectionListener listSelectionListener
This protected field is implementation specific. Do not access directly or override. Use the create method instead.
See Also:
listMouseListener
protected MouseListener listMouseListener
This protected field is implementation specific. Do not access directly or override. Use the create method instead.
See Also:
listMouseMotionListener
protected MouseMotionListener listMouseMotionListener
This protected field is implementation specific. Do not access directly or override. Use the create method instead
See Also:
createListMouseMotionListener()
propertyChangeListener
protected PropertyChangeListener propertyChangeListener
This protected field is implementation specific. Do not access directly or override. Use the create method instead
See Also:
createPropertyChangeListener()
listDataListener
protected ListDataListener listDataListener
This protected field is implementation specific. Do not access directly or override. Use the create method instead
See Also:
itemListener
protected ItemListener itemListener
This protected field is implementation specific. Do not access directly or override. Use the create method instead
See Also:
autoscrollTimer
protected Timer autoscrollTimer
This protected field is implementation specific. Do not access directly or override.
hasEntered
protected boolean hasEntered
isAutoScrolling
protected boolean isAutoScrolling
scrollDirection
protected int scrollDirection
SCROLL_UP
protected static final int SCROLL_UP
See Also:
SCROLL_DOWN
protected static final int SCROLL_DOWN
See Also:
Constructor Detail |
---|
BasicComboPopup
public BasicComboPopup(JComboBox combo)
Method Detail |
---|
show
public void show()
Implementation of ComboPopup.show().
Specified by:
[show](../../../../javax/swing/plaf/basic/ComboPopup.html#show%28%29)
in interface [ComboPopup](../../../../javax/swing/plaf/basic/ComboPopup.html "interface in javax.swing.plaf.basic")
Overrides:
[show](../../../../java/awt/Component.html#show%28%29)
in class [Component](../../../../java/awt/Component.html "class in java.awt")
hide
public void hide()
Implementation of ComboPopup.hide().
Specified by:
[hide](../../../../javax/swing/plaf/basic/ComboPopup.html#hide%28%29)
in interface [ComboPopup](../../../../javax/swing/plaf/basic/ComboPopup.html "interface in javax.swing.plaf.basic")
Overrides:
[hide](../../../../java/awt/Component.html#hide%28%29)
in class [Component](../../../../java/awt/Component.html "class in java.awt")
getList
public JList getList()
Implementation of ComboPopup.getList().
Specified by:
[getList](../../../../javax/swing/plaf/basic/ComboPopup.html#getList%28%29)
in interface [ComboPopup](../../../../javax/swing/plaf/basic/ComboPopup.html "interface in javax.swing.plaf.basic")
getMouseListener
public MouseListener getMouseListener()
Implementation of ComboPopup.getMouseListener().
Specified by:
[getMouseListener](../../../../javax/swing/plaf/basic/ComboPopup.html#getMouseListener%28%29)
in interface [ComboPopup](../../../../javax/swing/plaf/basic/ComboPopup.html "interface in javax.swing.plaf.basic")
Returns:
a MouseListener
or null
See Also:
getMouseMotionListener
public MouseMotionListener getMouseMotionListener()
Implementation of ComboPopup.getMouseMotionListener().
Specified by:
[getMouseMotionListener](../../../../javax/swing/plaf/basic/ComboPopup.html#getMouseMotionListener%28%29)
in interface [ComboPopup](../../../../javax/swing/plaf/basic/ComboPopup.html "interface in javax.swing.plaf.basic")
Returns:
a MouseMotionListener
or null
See Also:
ComboPopup.getMouseMotionListener()
getKeyListener
public KeyListener getKeyListener()
Implementation of ComboPopup.getKeyListener().
Specified by:
[getKeyListener](../../../../javax/swing/plaf/basic/ComboPopup.html#getKeyListener%28%29)
in interface [ComboPopup](../../../../javax/swing/plaf/basic/ComboPopup.html "interface in javax.swing.plaf.basic")
Returns:
a KeyListener
or null
See Also:
uninstallingUI
public void uninstallingUI()
Called when the UI is uninstalling. Since this popup isn't in the component tree, it won't get it's uninstallUI() called. It removes the listeners that were added in addComboBoxListeners().
Specified by:
[uninstallingUI](../../../../javax/swing/plaf/basic/ComboPopup.html#uninstallingUI%28%29)
in interface [ComboPopup](../../../../javax/swing/plaf/basic/ComboPopup.html "interface in javax.swing.plaf.basic")
uninstallComboBoxModelListeners
protected void uninstallComboBoxModelListeners(ComboBoxModel model)
Removes the listeners from the combo box model
Parameters:
model
- The combo box model to install listeners
See Also:
installComboBoxModelListeners(javax.swing.ComboBoxModel)
uninstallKeyboardActions
protected void uninstallKeyboardActions()
firePopupMenuWillBecomeVisible
protected void firePopupMenuWillBecomeVisible()
Description copied from class: [JPopupMenu](../../../../javax/swing/JPopupMenu.html#firePopupMenuWillBecomeVisible%28%29)
Notifies PopupMenuListener
s that this popup menu will become visible.
Overrides:
[firePopupMenuWillBecomeVisible](../../../../javax/swing/JPopupMenu.html#firePopupMenuWillBecomeVisible%28%29)
in class [JPopupMenu](../../../../javax/swing/JPopupMenu.html "class in javax.swing")
firePopupMenuWillBecomeInvisible
protected void firePopupMenuWillBecomeInvisible()
Description copied from class: [JPopupMenu](../../../../javax/swing/JPopupMenu.html#firePopupMenuWillBecomeInvisible%28%29)
Notifies PopupMenuListener
s that this popup menu will become invisible.
Overrides:
[firePopupMenuWillBecomeInvisible](../../../../javax/swing/JPopupMenu.html#firePopupMenuWillBecomeInvisible%28%29)
in class [JPopupMenu](../../../../javax/swing/JPopupMenu.html "class in javax.swing")
firePopupMenuCanceled
protected void firePopupMenuCanceled()
Description copied from class: [JPopupMenu](../../../../javax/swing/JPopupMenu.html#firePopupMenuCanceled%28%29)
Notifies PopupMenuListeners
that this popup menu is cancelled.
Overrides:
[firePopupMenuCanceled](../../../../javax/swing/JPopupMenu.html#firePopupMenuCanceled%28%29)
in class [JPopupMenu](../../../../javax/swing/JPopupMenu.html "class in javax.swing")
createMouseListener
protected MouseListener createMouseListener()
Creates a listener that will watch for mouse-press and release events on the combo box.Warning: When overriding this method, make sure to maintain the existing behavior.
Returns:
a MouseListener
which will be added to the combo box or null
createMouseMotionListener
protected MouseMotionListener createMouseMotionListener()
Creates the mouse motion listener which will be added to the combo box.Warning: When overriding this method, make sure to maintain the existing behavior.
Returns:
a MouseMotionListener
which will be added to the combo box or null
createKeyListener
protected KeyListener createKeyListener()
Creates the key listener that will be added to the combo box. If this method returns null then it will not be added to the combo box.
Returns:
a KeyListener
or null
createListSelectionListener
protected ListSelectionListener createListSelectionListener()
Creates a list selection listener that watches for selection changes in the popup's list. If this method returns null then it will not be added to the popup list.
Returns:
an instance of a ListSelectionListener
or null
createListDataListener
protected ListDataListener createListDataListener()
Creates a list data listener which will be added to theComboBoxModel
. If this method returns null then it will not be added to the combo box model.
Returns:
an instance of a ListDataListener
or null
createListMouseListener
protected MouseListener createListMouseListener()
Creates a mouse listener that watches for mouse events in the popup's list. If this method returns null then it will not be added to the combo box.
Returns:
an instance of a MouseListener
or null
createListMouseMotionListener
protected MouseMotionListener createListMouseMotionListener()
Creates a mouse motion listener that watches for mouse motion events in the popup's list. If this method returns null then it will not be added to the combo box.
Returns:
an instance of a MouseMotionListener
or null
createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener()
Creates a PropertyChangeListener
which will be added to the combo box. If this method returns null then it will not be added to the combo box.
Returns:
an instance of a PropertyChangeListener
or null
createItemListener
protected ItemListener createItemListener()
Creates an 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.
Returns:
an instance of an ItemListener
or null
createList
protected JList createList()
Creates the JList used in the popup to display the items in the combo box model. This method is called when the UI class is created.
Returns:
a JList
used to display the combo box items
configureList
protected void configureList()
Configures the list which is used to hold the combo box items in the popup. This method is called when the UI class is created.
See Also:
installListListeners
protected void installListListeners()
Adds the listeners to the list control.
createScroller
protected JScrollPane createScroller()
Creates the scroll pane which houses the scrollable list.
configureScroller
protected void configureScroller()
Configures the scrollable portion which holds the list within the combo box popup. This method is called when the UI class is created.
configurePopup
protected void configurePopup()
Configures the popup portion of the combo box. This method is called when the UI class is created.
installComboBoxListeners
protected void installComboBoxListeners()
This method adds the necessary listeners to the JComboBox.
installComboBoxModelListeners
protected void installComboBoxModelListeners(ComboBoxModel model)
Installs the listeners on the combo box model. Any listeners installed on the combo box model should be removed in uninstallComboBoxModelListeners
.
Parameters:
model
- The combo box model to install listeners
See Also:
uninstallComboBoxModelListeners(javax.swing.ComboBoxModel)
installKeyboardActions
protected void installKeyboardActions()
isFocusTraversable
public boolean isFocusTraversable()
Overridden to unconditionally return false.
Overrides:
[isFocusTraversable](../../../../java/awt/Component.html#isFocusTraversable%28%29)
in class [Component](../../../../java/awt/Component.html "class in java.awt")
Returns:
true
if this Component
is focusable; false
otherwise
See Also:
Component.setFocusable(boolean)
startAutoScrolling
protected void startAutoScrolling(int direction)
This protected method is implementation specific and should be private. do not call or override.
stopAutoScrolling
protected void stopAutoScrolling()
This protected method is implementation specific and should be private. do not call or override.
autoScrollUp
protected void autoScrollUp()
This protected method is implementation specific and should be private. do not call or override.
autoScrollDown
protected void autoScrollDown()
This protected method is implementation specific and should be private. do not call or override.
getAccessibleContext
public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this BasicComboPopup. The AccessibleContext will have its parent set to the ComboBox.
Specified by:
[getAccessibleContext](../../../../javax/accessibility/Accessible.html#getAccessibleContext%28%29)
in interface [Accessible](../../../../javax/accessibility/Accessible.html "interface in javax.accessibility")
Overrides:
[getAccessibleContext](../../../../javax/swing/JPopupMenu.html#getAccessibleContext%28%29)
in class [JPopupMenu](../../../../javax/swing/JPopupMenu.html "class in javax.swing")
Returns:
an AccessibleContext for the BasicComboPopup
Since:
1.5
delegateFocus
protected void delegateFocus(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. The standard implementation delegates the focus to the editor (if the combo box is editable) or to the JComboBox if it is not editable.
togglePopup
protected void togglePopup()
Makes the popup visible if it is hidden and makes it hidden if it is visible.
convertMouseEvent
protected MouseEvent convertMouseEvent(MouseEvent e)
getPopupHeightForRowCount
protected int getPopupHeightForRowCount(int maxRowCount)
Retrieves the height of the popup based on the current ListCellRenderer and the maximum row count.
computePopupBounds
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. If no transformations are required, then the returned rectangle will have the same values as the parameters.
Parameters:
px
- starting x location
py
- starting y location
pw
- starting width
ph
- starting height
Returns:
a rectangle which represents the placement and size of the popup
updateListBoxSelectionForEvent
protected void updateListBoxSelectionForEvent(MouseEvent anEvent, boolean shouldScroll)
A utility method used by the event listeners. Given a mouse event, it changes the list selection to the list item below the mouse.
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.