Class MetalComboBoxUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ComboBoxUI
javax.swing.plaf.basic.BasicComboBoxUI
javax.swing.plaf.metal.MetalComboBoxUI
Metal UI for JComboBox
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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThis class should be treated as a "protected" inner class.classDeprecated.As of Java 2 platform v1.4.classThis class should be treated as a "protected" inner class.Nested classes/interfaces declared in class BasicComboBoxUI
BasicComboBoxUI.ComboBoxLayoutManager, BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler, BasicComboBoxUI.PropertyChangeHandlerModifier and TypeClassDescriptionclassThis layout manager handles the 'standard' layout of combo boxes.classThis listener hides the popup when the focus is lost.classThis listener watches for changes to the selection in the combo box.classThis listener checks to see if the key event isn't a navigation key.classThis listener watches for changes in theComboBoxModel.classThis listener watches for bound properties that have changed in the combo box. -
Field Summary
Fields declared in class BasicComboBoxUI
arrowButton, cachedMinimumSize, comboBox, currentValuePane, editor, focusListener, hasFocus, isMinimumSizeDirty, itemListener, keyListener, listBox, listDataListener, padding, popup, popupKeyListener, popupMouseListener, popupMouseMotionListener, propertyChangeListener, squareButtonModifier and TypeFieldDescriptionprotected JButtonThe arrow button that invokes the popup.protected DimensionThe cached minimum preferred size.The instance ofJComboBox.protected CellRendererPaneUsed to render the currently selected item in the combo box.protected ComponentThe Component that theComboBoxEditoruses for editing.protected FocusListenerThis protected field is implementation specific.protected booleanThis protected field is implementation specific.protected booleanThe flag for recalculating the minimum preferred size.protected ItemListenerThis protected field is implementation specific.protected KeyListenerThis protected field is implementation specific.This list is for drawing the current item in the combo box.protected ListDataListenerThis protected field is implementation specific.protected InsetsIf specified, these insets act as padding around the cell renderer when laying out and painting the "selected" item in the combo box.protected ComboPopupThe implementation ofComboPopupthat is used to show the popup.protected KeyListenerTheKeyListenerlistens to events.protected MouseListenerTheMouseListenerlistens to events.protected MouseMotionListenerTheMouseMotionListenerlistens to events.protected PropertyChangeListenerThis protected field is implementation specific.protected booleanIndicates whether or not the combo box button should be square. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis protected method is implementation specific and should be private. do not call or override.Creates aPropertyChangeListenerwhich will be added to the combo box.static ComponentUIConstructs an instance ofMetalComboBoxUI.protected voidDeprecated.As of Java 2 platform v1.4.intgetBaseline(JComponent c, int width, int height) Returns the baseline.voidlayoutComboBox(Container parent, MetalComboBoxUI.MetalComboBoxLayoutManager manager) Lays out theJComboBoxin theparentcontainer.voidpaintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus) If necessary paints the currently selected item.voidpaintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus) If necessary paints the background of the currently selected item.protected voidDeprecated.As of Java 2 platform v1.4.voidThis protected method is implementation specific and should be private.Methods declared in class BasicComboBoxUI
addEditor, configureArrowButton, createArrowButton, createEditor, createFocusListener, createItemListener, createKeyListener, createLayoutManager, createListDataListener, createPopup, createRenderer, getBaselineResizeBehavior, getDefaultSize, getDisplaySize, getInsets, getMinimumSize, getSizeForComponent, installComponents, installDefaults, installKeyboardActions, installListeners, isFocusTraversable, isNavigationKey, isPopupVisible, rectangleForCurrentValue, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListenersModifier and TypeMethodDescriptionvoidThis public method is implementation specific and should be private. do not call or override.voidThis public method is implementation specific and should be private.protected JButtonCreates a button which will be used as the control to show or hide the popup portion of the combo box.protected ComboBoxEditorCreates the default editor that will be used in editable combo boxes.protected FocusListenerCreates aFocusListenerwhich will be added to the combo box.protected ItemListenerCreates anItemListenerwhich will be added to the combo box.protected KeyListenerCreates aKeyListenerwhich will be added to the combo box.protected LayoutManagerCreates a layout manager for managing the components which make up the combo box.protected ListDataListenerCreates a list data listener which will be added to theComboBoxModel.protected ComboPopupCreates the popup portion of the combo box.protected ListCellRenderer<Object> Creates the default renderer that will be used in a non-editiable combo box.Returns an enum indicating how the baseline of the component changes as the size changes.protected DimensionReturn the default size of an empty display area of the combo box using the current renderer and font.protected DimensionReturns the calculated size of the display area.protected InsetsGets the insets from the JComboBox.The minimum size is the size of the display area plus insets plus the button.protected DimensiongetSizeForComponent(Component comp) Returns the size a component would have if used as a cell renderer.protected voidCreates and initializes the components which make up the aggregate combo box.protected voidInstalls the default colors, default font, default renderer, and default editor into the JComboBox.protected voidAdds keyboard actions to the JComboBox.protected voidCreates and installs listeners for the combo box and its model.booleanisFocusTraversable(JComboBox<?> c) Determines if the JComboBox is focus traversable.protected booleanisNavigationKey(int keyCode) Returns whether or not the supplied keyCode maps to a key that is used for navigation.booleanisPopupVisible(JComboBox<?> c) Tells if the popup is visible or not.protected RectangleReturns the area that is reserved for drawing the currently selected item.voidThis public method is implementation specific and should be private. do not call or override.protected voidSelects the next item in the list.protected voidSelects the previous item in the list.voidsetPopupVisible(JComboBox<?> c, boolean v) Hides the popup.protected voidHides the popup if it is showing and shows the popup if it is hidden.voidThis public method is implementation specific and should be private.protected voidThe aggregate components which comprise the combo box are unregistered and uninitialized.protected voidUninstalls the default colors, default font, default renderer, and default editor from the combo box.protected voidRemoves the focus InputMap and ActionMap.protected voidRemoves the installed listeners from the combo box and its model.Methods declared in class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getPreferredSize, installUI, paint, uninstallUI, updateModifier and TypeMethodDescriptionbooleancontains(JComponent c, int x, int y) Returnstrueif the specified x,y location is contained within the look and feel's defined shape of the specified component.getAccessibleChild(JComponent c, int i) Returns theithAccessiblechild of the object.intReturns the number of accessible children in the object.Returns the specified component's maximum size appropriate for the look and feel.Returns the specified component's preferred size appropriate for the look and feel.voidConfigures the specified component appropriately for the look and feel.voidpaint(Graphics g, JComponent c) Paints the specified component appropriately for the look and feel.voidReverses configuration which was done on the specified component duringinstallUI.voidupdate(Graphics g, JComponent c) Notifies this UI delegate that it is time to paint the specified component.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
MetalComboBoxUI
public MetalComboBoxUI()Constructs aMetalComboBoxUI.
-
-
Method Details
-
createUI
Constructs an instance ofMetalComboBoxUI.- Parameters:
c- a component- Returns:
- an instance of
MetalComboBoxUI
-
paintCurrentValue
If necessary paints the currently selected item.- Overrides:
paintCurrentValuein classBasicComboBoxUI- Parameters:
g- Graphics to paint tobounds- Region to paint current value tohasFocus- whether or not the JComboBox has focus- Throws:
NullPointerException- if any of the arguments are null.- Since:
- 1.5
-
paintCurrentValueBackground
If necessary paints the background of the currently selected item.- Overrides:
paintCurrentValueBackgroundin classBasicComboBoxUI- Parameters:
g- Graphics to paint tobounds- Region to paint background tohasFocus- whether or not the JComboBox has focus- Throws:
NullPointerException- if any of the arguments are null.- Since:
- 1.5
-
getBaseline
Returns the baseline.- Overrides:
getBaselinein classBasicComboBoxUI- Parameters:
c-JComponentbaseline is being requested forwidth- the width to get the baseline forheight- the height to get the baseline for- Returns:
- baseline or a value < 0 indicating there is no reasonable baseline
- Throws:
NullPointerException- ifcisnullIllegalArgumentException- if width or height is < 0- Since:
- 1.6
- See Also:
-
createPropertyChangeListener
Description copied from class:BasicComboBoxUICreates aPropertyChangeListenerwhich will be added to the combo box. If this method returns null then it will not be added to the combo box.- Overrides:
createPropertyChangeListenerin classBasicComboBoxUI- Returns:
- an instance of a
PropertyChangeListeneror null
-
editablePropertyChanged
Deprecated.As of Java 2 platform v1.4.As of Java 2 platform v1.4 this method is no longer used. Do not call or override. All the functionality of this method is in the MetalPropertyChangeListener.- Parameters:
e- an instance ofPropertyChangeEvent
-
layoutComboBox
Lays out theJComboBoxin theparentcontainer.- Parameters:
parent- a containermanager- an instance ofMetalComboBoxLayoutManager
-
removeListeners
Deprecated.As of Java 2 platform v1.4.As of Java 2 platform v1.4 this method is no longer used. -
configureEditor
public void configureEditor()Description copied from class:BasicComboBoxUIThis protected method is implementation specific and should be private. do not call or override.- Overrides:
configureEditorin classBasicComboBoxUI- See Also:
-
unconfigureEditor
public void unconfigureEditor()Description copied from class:BasicComboBoxUIThis protected method is implementation specific and should be private. Do not call or override.- Overrides:
unconfigureEditorin classBasicComboBoxUI- See Also:
-