java.lang.Object | |||||
↳ | java.awt.Component | ||||
↳ | java.awt.Container | ||||
↳ | javax.swing.JComponent | ||||
↳ | javax.swing.JPopupMenu | ||||
↳ | javax.swing.plaf.basic.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 Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BasicComboPopup.InvocationKeyHandler | As of Java 2 platform v 1.4, this class is now obsolete and is only included for backwards API compatibility. | ||||||||||
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. | ||||||||||
BasicComboPopup.InvocationMouseMotionHandler | This listener watches for dragging and updates the current selection in the list if it is dragging over the list. | ||||||||||
BasicComboPopup.ItemHandler | This listener watches for changes to the selection in the combo box. | ||||||||||
BasicComboPopup.ListDataHandler | As of 1.4, this class is now obsolete, doesn't do anything, and is only included for backwards API compatibility. | ||||||||||
BasicComboPopup.ListMouseHandler | This listener hides the popup when the mouse is released in the list. | ||||||||||
BasicComboPopup.ListMouseMotionHandler | This listener changes the selected item as you move the mouse over the list. | ||||||||||
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. | ||||||||||
BasicComboPopup.PropertyChangeHandler | This listener watches for bound properties that have changed in the combo box. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | SCROLL_DOWN | ||||||||||
int | SCROLL_UP |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
autoscrollTimer | This protected field is implementation specific. | ||||||||||
comboBox | |||||||||||
hasEntered | |||||||||||
isAutoScrolling | |||||||||||
itemListener | This protected field is implementation specific. | ||||||||||
keyListener | This protected field is implementation specific. | ||||||||||
list | This protected field is implementation specific. | ||||||||||
listDataListener | This protected field is implementation specific. | ||||||||||
listMouseListener | This protected field is implementation specific. | ||||||||||
listMouseMotionListener | This protected field is implementation specific. | ||||||||||
listSelectionListener | This protected field is implementation specific. | ||||||||||
mouseListener | This protected field is implementation specific. | ||||||||||
mouseMotionListener | This protected field is implementation specific. | ||||||||||
propertyChangeListener | This protected field is implementation specific. | ||||||||||
scrollDirection | |||||||||||
scroller | This protected field is implementation specific. | ||||||||||
valueIsAdjusting | As of Java 2 platform v1.4 this previously undocumented field is no longer used. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the AccessibleContext associated with this BasicComboPopup.
| |||||||||||
Implementation of ComboPopup.getKeyListener().
| |||||||||||
Implementation of ComboPopup.getList().
| |||||||||||
Implementation of ComboPopup.getMouseListener().
| |||||||||||
Implementation of ComboPopup.getMouseMotionListener().
| |||||||||||
This method is deprecated.
As of JDK version 1.1,
replaced by
setVisible(boolean) .
| |||||||||||
This method is deprecated.
As of 1.4, replaced by
isFocusable() .
| |||||||||||
This method is deprecated.
As of JDK version 1.1,
replaced by
setVisible(boolean) .
| |||||||||||
Called when the UI is uninstalling.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This protected method is implementation specific and should be private.
| |||||||||||
This protected method is implementation specific and should be private.
| |||||||||||
Calculate the placement and size of the popup portion of the combo box based
on the combo box location and the enclosing screen bounds.
| |||||||||||
Configures the list which is used to hold the combo box items in the
popup.
| |||||||||||
Configures the popup portion of the combo box.
| |||||||||||
Configures the scrollable portion which holds the list within
the combo box popup.
| |||||||||||
Creates an
ItemListener which will be added to the
combo box. | |||||||||||
Creates the key listener that will be added to the combo box.
| |||||||||||
Creates the JList used in the popup to display
the items in the combo box model.
| |||||||||||
Creates a list data listener which will be added to the
ComboBoxModel . | |||||||||||
Creates a mouse listener that watches for mouse events in
the popup's list.
| |||||||||||
Creates a mouse motion listener that watches for mouse motion
events in the popup's list.
| |||||||||||
Creates a list selection listener that watches for selection changes in
the popup's list.
| |||||||||||
Creates a listener
that will watch for mouse-press and release events on the combo box.
| |||||||||||
Creates the mouse motion listener which will be added to the combo
box.
| |||||||||||
Creates a
PropertyChangeListener which will be added to
the combo box. | |||||||||||
Creates the scroll pane which houses the scrollable list.
| |||||||||||
This is is a utility method that helps event handlers figure out where to
send the focus when the popup is brought up.
| |||||||||||
Notifies
PopupMenuListeners that this popup menu is
cancelled. | |||||||||||
Notifies
PopupMenuListener s that this popup menu will
become invisible. | |||||||||||
Notifies
PopupMenuListener s that this popup menu will
become visible. | |||||||||||
Retrieves the height of the popup based on the current
ListCellRenderer and the maximum row count.
| |||||||||||
This method adds the necessary listeners to the JComboBox.
| |||||||||||
Installs the listeners on the combo box model.
| |||||||||||
Adds the listeners to the list control.
| |||||||||||
This protected method is implementation specific and should be private.
| |||||||||||
This protected method is implementation specific and should be private.
| |||||||||||
Makes the popup visible if it is hidden and makes it hidden if it is
visible.
| |||||||||||
Removes the listeners from the combo box model
| |||||||||||
A utility method used by the event listeners.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
This protected field is implementation specific. Do not access directly or override.
This protected field is implementation specific. Do not access directly or override. Use the create method instead
This protected field is implementation specific. Do not access directly or override. Use the accessor or create methods instead.
This protected field is implementation specific. Do not access directly or override. Use the accessor methods instead.
This protected field is implementation specific. Do not access directly or override. Use the create method instead
This protected field is implementation specific. Do not access directly or override. Use the create method instead.
This protected field is implementation specific. Do not access directly or override. Use the create method instead
This protected field is implementation specific. Do not access directly or override. Use the create method instead.
This protected field is implementation specific. Do not access directly or override. Use the accessor or create methods instead.
This protected field is implementation specific. Do not access directly or override. Use the accessor or create methods instead.
This protected field is implementation specific. Do not access directly or override. Use the create method instead
This protected field is implementation specific. Do not access directly or override. Use the create method instead
As of Java 2 platform v1.4 this previously undocumented field is no longer used.
Gets the AccessibleContext associated with this BasicComboPopup. The AccessibleContext will have its parent set to the ComboBox.
Implementation of ComboPopup.getKeyListener().
KeyListener
or nullImplementation of ComboPopup.getMouseListener().
MouseListener
or nullImplementation of ComboPopup.getMouseMotionListener().
MouseMotionListener
or null
This method is deprecated.
As of JDK version 1.1,
replaced by setVisible(boolean)
.
Implementation of ComboPopup.hide().
This method is deprecated.
As of 1.4, replaced by isFocusable()
.
Overridden to unconditionally return false.
true
if this Component
is
focusable; false
otherwise
This method is deprecated.
As of JDK version 1.1,
replaced by setVisible(boolean)
.
Implementation of ComboPopup.show().
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().
This protected method is implementation specific and should be private. do not call or override.
This protected method is implementation specific and should be private. do not call or override.
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.
px | starting x location |
---|---|
py | starting y location |
pw | starting width |
ph | starting height |
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.
Configures the popup portion of the combo box. This method is called when the UI class is created.
Configures the scrollable portion which holds the list within the combo box popup. This method is called when the UI class is created.
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.
ItemListener
or null
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.
KeyListener
or null
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.
JList
used to display the combo box items
Creates a list data listener which will be added to the
ComboBoxModel
. If this method returns null then
it will not be added to the combo box model.
ListDataListener
or null
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.
MouseListener
or null
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.
MouseMotionListener
or null
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.
ListSelectionListener
or null
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.
MouseListener
which will be added to
the combo box or null
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.
MouseMotionListener
which will be added to
the combo box or null
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.
PropertyChangeListener
or null
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.
Notifies PopupMenuListeners
that this popup menu is
cancelled.
Notifies PopupMenuListener
s that this popup menu will
become invisible.
Notifies PopupMenuListener
s that this popup menu will
become visible.
Retrieves the height of the popup based on the current ListCellRenderer and the maximum row count.
This method adds the necessary listeners to the JComboBox.
Installs the listeners on the combo box model. Any listeners installed
on the combo box model should be removed in
uninstallComboBoxModelListeners
.
model | The combo box model to install listeners |
---|
Adds the listeners to the list control.
This protected method is implementation specific and should be private. do not call or override.
This protected method is implementation specific and should be private. do not call or override.
Makes the popup visible if it is hidden and makes it hidden if it is visible.
Removes the listeners from the combo box model
model | The combo box model to install listeners |
---|
A utility method used by the event listeners. Given a mouse event, it changes the list selection to the list item below the mouse.