javax.swing.plaf.basic

Class BasicComboPopup

public class BasicComboPopup extends JPopupMenu implements ComboPopup

UI Delegate for ComboPopup
Nested Class Summary
classBasicComboPopup.InvocationKeyHandler
This class is not used anymore
protected classBasicComboPopup.InvocationMouseHandler
InvocationMouseHandler is a listener that listens to mouse events occuring in the combo box.
protected classBasicComboPopup.InvocationMouseMotionHandler
InvocationMouseMotionListener is a mouse listener that listens to mouse dragging events occuring in the combo box.
protected classBasicComboPopup.ItemHandler
ItemHandler is an item listener that listens to selection events occuring in the combo box.
classBasicComboPopup.ListDataHandler
This class is not used any more.
protected classBasicComboPopup.ListMouseHandler
ListMouseHandler is a listener that listens to mouse events occuring in the combo box's list of items.
protected classBasicComboPopup.ListMouseMotionHandler
ListMouseMotionHandler listens to mouse motion events occuring in the combo box's list.
protected classBasicComboPopup.ListSelectionHandler
This class is not used anymore
protected classBasicComboPopup.PropertyChangeHandler
This class listens to changes occuring in the bound properties of the combo box
Field Summary
protected TimerautoscrollTimer
protected JComboBoxcomboBox
ComboBox associated with this popup
protected booleanhasEntered
FIXME: Need to document
protected booleanisAutoScrolling
Indicates whether the scroll bar located in popup menu with comboBox's list of items is currently autoscrolling.
protected ItemListeneritemListener
ItemListener listening to the selection changes in the combo box
protected KeyListenerkeyListener
This listener is not used
protected JListlist
JList which is used to display item is the combo box
protected ListDataListenerlistDataListener
This listener is not used
protected MouseListenerlistMouseListener
MouseListener listening to mouse events occuring in the combo box's list.
protected MouseMotionListenerlistMouseMotionListener
MouseMotionListener listening to mouse motion events occuring in the combo box's list
protected ListSelectionListenerlistSelectionListener
This listener is not used
protected MouseListenermouseListener
MouseListener listening to mouse events occuring in the combo box
protected MouseMotionListenermouseMotionListener
MouseMotionListener listening to mouse motion events occuring in the combo box
protected PropertyChangeListenerpropertyChangeListener
PropertyChangeListener listening to changes occuring in the bound properties of the combo box
protected intscrollDirection
Indicates auto scrolling direction
protected JScrollPanescroller
JScrollPane that contains list portion of the combo box
protected static intSCROLL_DOWN
direction for scrolling down list of combo box's items
protected static intSCROLL_UP
direction for scrolling up list of combo box's items
protected booleanvalueIsAdjusting
This field is not used
Constructor Summary
BasicComboPopup(JComboBox comboBox)
Creates a new BasicComboPopup object.
Method Summary
protected voidautoScrollDown()
This method scrolls down list of combo box's and highlights item in the list that just became visible.
protected voidautoScrollUp()
This method scrolls up list of combo box's items up and highlights that just became visible.
protected RectanglecomputePopupBounds(int px, int py, int pw, int ph)
DOCUMENT ME!
protected voidconfigureList()
This method configures the list of comboBox's items by setting default properties and installing listeners.
protected voidconfigurePopup()
This method configures popup menu that will be used to display Scrollpane with list of items inside of it.
protected voidconfigureScroller()
This method configures scroll pane to contain list of comboBox's items
protected MouseEventconvertMouseEvent(MouseEvent e)
DOCUMENT ME!
protected ItemListenercreateItemListener()
Creates new ItemListener that will listen to ItemEvents occuring in the combo box.
protected KeyListenercreateKeyListener()
KeyListener created in this method is not used anymore.
protected JListcreateList()
Creates JList that will be used to display items in the combo box.
protected ListDataListenercreateListDataListener()
Creates ListDataListener.
protected MouseListenercreateListMouseListener()
This method creates ListMouseListener to listen to mouse events occuring in the combo box's item list.
protected MouseMotionListenercreateListMouseMotionListener()
Creates ListMouseMotionlistener to listen to mouse motion events occuring in the combo box's list.
protected ListSelectionListenercreateListSelectionListener()
ListSelectionListener created in this method is not used anymore
protected MouseListenercreateMouseListener()
Creates MouseListener to listen to mouse events occuring in the combo box.
protected MouseMotionListenercreateMouseMotionListener()
Create Mouse listener that listens to mouse dragging events occuring in the combo box.
protected PropertyChangeListenercreatePropertyChangeListener()
Creates PropertyChangeListener to handle changes in the JComboBox's bound properties.
protected JScrollPanecreateScroller()
This method creates scroll pane that will contain the list of comboBox's items inside of it.
protected voiddelegateFocus(MouseEvent e)
This method helps to delegate focus to the right component in the JComboBox.
protected voidfirePopupMenuCanceled()
This method fires PopupMenuEvent indicating that combo box's popup list of items was closed without selection.
protected voidfirePopupMenuWillBecomeInvisible()
This method fires PopupMenuEvent indicating that combo box's popup list of items will become invisible.
protected voidfirePopupMenuWillBecomeVisible()
This method fires PopupMenuEvent indicating that combo box's popup list of items will become visible
KeyListenergetKeyListener()
Returns KeyListener listening to key events occuring in the combo box.
JListgetList()
Return list cointaining JComboBox's items
MouseListenergetMouseListener()
Returns MouseListener that is listening to mouse events occuring in the combo box.
MouseMotionListenergetMouseMotionListener()
Returns MouseMotionListener that is listening to mouse motion events occuring in the combo box.
protected intgetPopupHeightForRowCount(int maxRowCount)
Returns required height of the popup such that number of items visible in it are equal to the maximum row count.
voidhide()
This method hides drop down list of items
protected voidinstallComboBoxListeners()
protected voidinstallComboBoxModelListeners(ComboBoxModel model)
This method installs listeners that will listen to changes occuring in the comb box's data model
protected voidinstallKeyboardActions()
Installs the keyboard actions.
protected voidinstallListListeners()
This method installs list listeners.
booleanisFocusTraversable()
This method always returns false to indicate that items in the combo box list are not focus traversable.
voidshow()
This method displays drow down list of combo box items on the screen.
protected voidstartAutoScrolling(int direction)
This method start scrolling combo box's list of items either up or down depending on the specified 'direction'
protected voidstopAutoScrolling()
This method stops scrolling the combo box's list of items
protected voidtogglePopup()
This method displays combo box popup if the popup is not currently shown on the screen and hides it if it is currently visible
protected voiduninstallComboBoxModelListeners(ComboBoxModel model)
This method uninstalls listeners that were listening to changes occuring in the comb box's data model
voiduninstallingUI()
This method uninstalls the UI for the given JComponent.
protected voiduninstallKeyboardActions()
This method uninstalls keyboard actions installed by the UI.
protected voidupdateListBoxSelectionForEvent(MouseEvent anEvent, boolean shouldScroll)
This method changes the selection in the list to the item over which the mouse is currently located.

Field Detail

autoscrollTimer

protected Timer autoscrollTimer

comboBox

protected JComboBox comboBox
ComboBox associated with this popup

hasEntered

protected boolean hasEntered
FIXME: Need to document

isAutoScrolling

protected boolean isAutoScrolling
Indicates whether the scroll bar located in popup menu with comboBox's list of items is currently autoscrolling. This happens when mouse event originated in the combo box and is dragged outside of its bounds

itemListener

protected ItemListener itemListener
ItemListener listening to the selection changes in the combo box

keyListener

protected KeyListener keyListener
This listener is not used

list

protected JList list
JList which is used to display item is the combo box

listDataListener

protected ListDataListener listDataListener
This listener is not used

listMouseListener

protected MouseListener listMouseListener
MouseListener listening to mouse events occuring in the combo box's list.

listMouseMotionListener

protected MouseMotionListener listMouseMotionListener
MouseMotionListener listening to mouse motion events occuring in the combo box's list

listSelectionListener

protected ListSelectionListener listSelectionListener
This listener is not used

mouseListener

protected MouseListener mouseListener
MouseListener listening to mouse events occuring in the combo box

mouseMotionListener

protected MouseMotionListener mouseMotionListener
MouseMotionListener listening to mouse motion events occuring in the combo box

propertyChangeListener

protected PropertyChangeListener propertyChangeListener
PropertyChangeListener listening to changes occuring in the bound properties of the combo box

scrollDirection

protected int scrollDirection
Indicates auto scrolling direction

scroller

protected JScrollPane scroller
JScrollPane that contains list portion of the combo box

protected static final int SCROLL_DOWN
direction for scrolling down list of combo box's items

protected static final int SCROLL_UP
direction for scrolling up list of combo box's items

valueIsAdjusting

protected boolean valueIsAdjusting
This field is not used

Constructor Detail

BasicComboPopup

public BasicComboPopup(JComboBox comboBox)
Creates a new BasicComboPopup object.

Parameters: comboBox the combo box with which this popup should be associated

Method Detail

autoScrollDown

protected void autoScrollDown()
This method scrolls down list of combo box's and highlights item in the list that just became visible.

autoScrollUp

protected void autoScrollUp()
This method scrolls up list of combo box's items up and highlights that just became visible.

computePopupBounds

protected Rectangle computePopupBounds(int px, int py, int pw, int ph)
DOCUMENT ME!

Parameters: px DOCUMENT ME! py DOCUMENT ME! pw DOCUMENT ME! ph DOCUMENT ME!

Returns: DOCUMENT ME!

configureList

protected void configureList()
This method configures the list of comboBox's items by setting default properties and installing listeners.

configurePopup

protected void configurePopup()
This method configures popup menu that will be used to display Scrollpane with list of items inside of it.

configureScroller

protected void configureScroller()
This method configures scroll pane to contain list of comboBox's items

convertMouseEvent

protected MouseEvent convertMouseEvent(MouseEvent e)
DOCUMENT ME!

Parameters: e DOCUMENT ME!

Returns: DOCUMENT ME!

createItemListener

protected ItemListener createItemListener()
Creates new ItemListener that will listen to ItemEvents occuring in the combo box.

Returns: ItemListener to listen to ItemEvents occuring in the combo box.

createKeyListener

protected KeyListener createKeyListener()
KeyListener created in this method is not used anymore.

Returns: KeyListener that does nothing

createList

protected JList createList()
Creates JList that will be used to display items in the combo box.

Returns: JList that will be used to display items in the combo box.

createListDataListener

protected ListDataListener createListDataListener()
Creates ListDataListener. This method returns null, because ListDataHandler class is obsolete and is no longer used.

Returns: null

createListMouseListener

protected MouseListener createListMouseListener()
This method creates ListMouseListener to listen to mouse events occuring in the combo box's item list.

Returns: MouseListener to listen to mouse events occuring in the combo box's items list.

createListMouseMotionListener

protected MouseMotionListener createListMouseMotionListener()
Creates ListMouseMotionlistener to listen to mouse motion events occuring in the combo box's list. This listener is responsible for highlighting items in the list when mouse is moved over them.

Returns: MouseMotionListener that handles mouse motion events occuring in the list of the combo box.

createListSelectionListener

protected ListSelectionListener createListSelectionListener()
ListSelectionListener created in this method is not used anymore

Returns: ListSelectionListener that does nothing

createMouseListener

protected MouseListener createMouseListener()
Creates MouseListener to listen to mouse events occuring in the combo box. Note that this listener doesn't listen to mouse events occuring in the popup portion of the combo box, it only listens to main combo box part.

Returns: new MouseMotionListener that listens to mouse events occuring in the combo box

createMouseMotionListener

protected MouseMotionListener createMouseMotionListener()
Create Mouse listener that listens to mouse dragging events occuring in the combo box. This listener is responsible for changing the selection in the combo box list to the component over which mouse is being currently dragged

Returns: new MouseMotionListener that listens to mouse dragging events occuring in the combo box

createPropertyChangeListener

protected PropertyChangeListener createPropertyChangeListener()
Creates PropertyChangeListener to handle changes in the JComboBox's bound properties.

Returns: PropertyChangeListener to handle changes in the JComboBox's bound properties.

createScroller

protected JScrollPane createScroller()
This method creates scroll pane that will contain the list of comboBox's items inside of it.

Returns: JScrollPane

delegateFocus

protected void delegateFocus(MouseEvent e)
This method helps to delegate focus to the right component in the JComboBox. If the comboBox is editable then focus is sent to ComboBoxEditor, otherwise it is delegated to JComboBox.

Parameters: e MouseEvent

firePopupMenuCanceled

protected void firePopupMenuCanceled()
This method fires PopupMenuEvent indicating that combo box's popup list of items was closed without selection.

firePopupMenuWillBecomeInvisible

protected void firePopupMenuWillBecomeInvisible()
This method fires PopupMenuEvent indicating that combo box's popup list of items will become invisible.

firePopupMenuWillBecomeVisible

protected void firePopupMenuWillBecomeVisible()
This method fires PopupMenuEvent indicating that combo box's popup list of items will become visible

getKeyListener

public KeyListener getKeyListener()
Returns KeyListener listening to key events occuring in the combo box. This method returns null because KeyHandler is not longer used.

Returns: KeyListener

getList

public JList getList()
Return list cointaining JComboBox's items

Returns: list cointaining JComboBox's items

getMouseListener

public MouseListener getMouseListener()
Returns MouseListener that is listening to mouse events occuring in the combo box.

Returns: MouseListener

getMouseMotionListener

public MouseMotionListener getMouseMotionListener()
Returns MouseMotionListener that is listening to mouse motion events occuring in the combo box.

Returns: MouseMotionListener

getPopupHeightForRowCount

protected int getPopupHeightForRowCount(int maxRowCount)
Returns required height of the popup such that number of items visible in it are equal to the maximum row count. By default comboBox.maximumRowCount=8

Parameters: maxRowCount number of maximum visible rows in the combo box's popup list of items

Returns: height of the popup required to fit number of items equal to JComboBox.maximumRowCount.

hide

public void hide()
This method hides drop down list of items

installComboBoxListeners

protected void installComboBoxListeners()

installComboBoxModelListeners

protected void installComboBoxModelListeners(ComboBoxModel model)
This method installs listeners that will listen to changes occuring in the comb box's data model

Parameters: model data model for the combo box for which to install listeners

installKeyboardActions

protected void installKeyboardActions()
Installs the keyboard actions.

installListListeners

protected void installListListeners()
This method installs list listeners.

isFocusTraversable

public boolean isFocusTraversable()
This method always returns false to indicate that items in the combo box list are not focus traversable.

Returns: false

show

public void show()
This method displays drow down list of combo box items on the screen.

startAutoScrolling

protected void startAutoScrolling(int direction)
This method start scrolling combo box's list of items either up or down depending on the specified 'direction'

Parameters: direction of the scrolling.

stopAutoScrolling

protected void stopAutoScrolling()
This method stops scrolling the combo box's list of items

togglePopup

protected void togglePopup()
This method displays combo box popup if the popup is not currently shown on the screen and hides it if it is currently visible

uninstallComboBoxModelListeners

protected void uninstallComboBoxModelListeners(ComboBoxModel model)
This method uninstalls listeners that were listening to changes occuring in the comb box's data model

Parameters: model data model for the combo box from which to uninstall listeners

uninstallingUI

public void uninstallingUI()
This method uninstalls the UI for the given JComponent.

uninstallKeyboardActions

protected void uninstallKeyboardActions()
This method uninstalls keyboard actions installed by the UI.

updateListBoxSelectionForEvent

protected void updateListBoxSelectionForEvent(MouseEvent anEvent, boolean shouldScroll)
This method changes the selection in the list to the item over which the mouse is currently located.

Parameters: anEvent MouseEvent shouldScroll DOCUMENT ME!