| 
 | Java™ Platform Standard Ed. 6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPopupMenu
javax.swing.plaf.basic.BasicComboPopup
public class BasicComboPopup
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 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 JavaBeansTM
 has been added to the java.beans package.
 Please see XMLEncoder.
| Nested Class Summary | |
|---|---|
|  class | BasicComboPopup.InvocationKeyHandlerAs of Java 2 platform v 1.4, this class is now obsolete and is only included for backwards API compatibility. | 
| protected  class | BasicComboPopup.InvocationMouseHandlerA 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.InvocationMouseMotionHandlerThis listener watches for dragging and updates the current selection in the list if it is dragging over the list. | 
| protected  class | BasicComboPopup.ItemHandlerThis listener watches for changes to the selection in the combo box. | 
|  class | BasicComboPopup.ListDataHandlerAs of 1.4, this class is now obsolete, doesn't do anything, and is only included for backwards API compatibility. | 
| protected  class | BasicComboPopup.ListMouseHandlerThis listener hides the popup when the mouse is released in the list. | 
| protected  class | BasicComboPopup.ListMouseMotionHandlerThis listener changes the selected item as you move the mouse over the list. | 
| protected  class | BasicComboPopup.ListSelectionHandlerAs 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.PropertyChangeHandlerThis 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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy | 
| Field Summary | |
|---|---|
| protected  Timer | autoscrollTimerThis protected field is implementation specific. | 
| protected  JComboBox | comboBox | 
| protected  boolean | hasEntered | 
| protected  boolean | isAutoScrolling | 
| protected  ItemListener | itemListenerThis protected field is implementation specific. | 
| protected  KeyListener | keyListenerThis protected field is implementation specific. | 
| protected  JList | listThis protected field is implementation specific. | 
| protected  ListDataListener | listDataListenerThis protected field is implementation specific. | 
| protected  MouseListener | listMouseListenerThis protected field is implementation specific. | 
| protected  MouseMotionListener | listMouseMotionListenerThis protected field is implementation specific. | 
| protected  ListSelectionListener | listSelectionListenerThis protected field is implementation specific. | 
| protected  MouseListener | mouseListenerThis protected field is implementation specific. | 
| protected  MouseMotionListener | mouseMotionListenerThis protected field is implementation specific. | 
| protected  PropertyChangeListener | propertyChangeListenerThis protected field is implementation specific. | 
| protected static int | SCROLL_DOWN | 
| protected static int | SCROLL_UP | 
| protected  int | scrollDirection | 
| protected  JScrollPane | scrollerThis protected field is implementation specific. | 
| protected  boolean | valueIsAdjustingAs 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(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 ItemListenerwhich 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 PropertyChangeListenerwhich 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 PopupMenuListenersthat 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(MouseEvent anEvent,
                               boolean shouldScroll)A utility method used by the event listeners. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface javax.swing.plaf.basic.ComboPopup | 
|---|
| isVisible | 
| Field Detail | 
|---|
protected JComboBox comboBox
protected JList list
getList(), 
createList()protected JScrollPane scroller
createScroller()protected boolean valueIsAdjusting
protected MouseMotionListener mouseMotionListener
getMouseMotionListener(), 
createMouseMotionListener()protected MouseListener mouseListener
getMouseListener(), 
createMouseListener()protected KeyListener keyListener
getKeyListener(), 
createKeyListener()protected ListSelectionListener listSelectionListener
createListSelectionListener()protected MouseListener listMouseListener
createListMouseListener()protected MouseMotionListener listMouseMotionListener
createListMouseMotionListener()protected PropertyChangeListener propertyChangeListener
createPropertyChangeListener()protected ListDataListener listDataListener
createListDataListener()protected ItemListener itemListener
createItemListener()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()
show in interface ComboPopupshow in class Componentpublic void hide()
hide in interface ComboPopuphide in class Componentpublic JList getList()
getList in interface ComboPopuppublic MouseListener getMouseListener()
getMouseListener in interface ComboPopupMouseListener or nullComboPopup.getMouseListener()public MouseMotionListener getMouseMotionListener()
getMouseMotionListener in interface ComboPopupMouseMotionListener or nullComboPopup.getMouseMotionListener()public KeyListener getKeyListener()
getKeyListener in interface ComboPopupKeyListener or nullComboPopup.getKeyListener()public void uninstallingUI()
uninstallingUI in interface ComboPopupprotected void uninstallComboBoxModelListeners(ComboBoxModel model)
model - The combo box model to install listenersinstallComboBoxModelListeners(javax.swing.ComboBoxModel)protected void uninstallKeyboardActions()
protected void firePopupMenuWillBecomeVisible()
JPopupMenuPopupMenuListeners that this popup menu will 
 become visible.
firePopupMenuWillBecomeVisible in class JPopupMenuprotected void firePopupMenuWillBecomeInvisible()
JPopupMenuPopupMenuListeners that this popup menu will 
 become invisible.
firePopupMenuWillBecomeInvisible in class JPopupMenuprotected void firePopupMenuCanceled()
JPopupMenuPopupMenuListeners that this popup menu is 
 cancelled.
firePopupMenuCanceled in class JPopupMenuprotected MouseListener createMouseListener()
MouseListener which will be added to 
 the combo box or nullprotected MouseMotionListener createMouseMotionListener()
MouseMotionListener which will be added to
         the combo box or nullprotected KeyListener createKeyListener()
KeyListener or nullprotected ListSelectionListener createListSelectionListener()
ListSelectionListener or nullprotected ListDataListener createListDataListener()
ComboBoxModel. If this method returns null then
 it will not be added to the combo box model.
ListDataListener or nullprotected MouseListener createListMouseListener()
MouseListener or nullprotected MouseMotionListener createListMouseMotionListener()
MouseMotionListener or nullprotected PropertyChangeListener createPropertyChangeListener()
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 nullprotected ItemListener createItemListener()
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 nullprotected JList createList()
JList used to display the combo box itemsprotected void configureList()
createList()protected void installListListeners()
protected JScrollPane createScroller()
protected void configureScroller()
protected void configurePopup()
protected void installComboBoxListeners()
protected void installComboBoxModelListeners(ComboBoxModel model)
uninstallComboBoxModelListeners.
model - The combo box model to install listenersuninstallComboBoxModelListeners(javax.swing.ComboBoxModel)protected void installKeyboardActions()
public boolean isFocusTraversable()
isFocusTraversable in class Componenttrue if this Component is
 focusable; false otherwiseComponent.setFocusable(boolean)protected void startAutoScrolling(int direction)
protected void stopAutoScrolling()
protected void autoScrollUp()
protected void autoScrollDown()
public AccessibleContext getAccessibleContext()
getAccessibleContext in interface AccessiblegetAccessibleContext in class JPopupMenuprotected void delegateFocus(MouseEvent e)
protected void togglePopup()
protected MouseEvent convertMouseEvent(MouseEvent e)
protected int getPopupHeightForRowCount(int maxRowCount)
protected Rectangle computePopupBounds(int px,
                                       int py,
                                       int pw,
                                       int ph)
px - starting x locationpy - starting y locationpw - starting widthph - starting height
protected void updateListBoxSelectionForEvent(MouseEvent anEvent,
                                              boolean shouldScroll)
| 
 | Java™ Platform Standard Ed. 6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright © 1993, 2010, Oracle and/or its affiliates. All rights reserved.