- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ComboBoxUI
-
- javax.swing.plaf.basic.BasicComboBoxUI
-
- javax.swing.plaf.metal.MetalComboBoxUI
-
public class MetalComboBoxUI extends BasicComboBoxUI
Metal UI for JComboBoxWarning: 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 seeXMLEncoder
.- See Also:
MetalComboBoxEditor
,MetalComboBoxButton
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description class
MetalComboBoxUI.MetalComboBoxLayoutManager
This class should be treated as a "protected" inner class.class
MetalComboBoxUI.MetalComboPopup
Deprecated.As of Java 2 platform v1.4.class
MetalComboBoxUI.MetalPropertyChangeListener
This class should be treated as a "protected" inner class.-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicComboBoxUI
BasicComboBoxUI.ComboBoxLayoutManager, BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler, BasicComboBoxUI.PropertyChangeHandler
-
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.BasicComboBoxUI
arrowButton, cachedMinimumSize, comboBox, currentValuePane, editor, focusListener, hasFocus, isMinimumSizeDirty, itemListener, keyListener, listBox, listDataListener, padding, popup, popupKeyListener, popupMouseListener, popupMouseMotionListener, propertyChangeListener, squareButton
-
-
Constructor Summary
Constructors Constructor and Description MetalComboBoxUI()
-
Method Summary
Methods Modifier and Type Method and Description void
configureEditor()
This protected method is implementation specific and should be private.protected JButton
createArrowButton()
Creates a button which will be used as the control to show or hide the popup portion of the combo box.protected ComboBoxEditor
createEditor()
Creates the default editor that will be used in editable combo boxes.protected LayoutManager
createLayoutManager()
Creates a layout manager for managing the components which make up the combo box.protected ComboPopup
createPopup()
Creates the popup portion of the combo box.PropertyChangeListener
createPropertyChangeListener()
Creates aPropertyChangeListener
which will be added to the combo box.static ComponentUI
createUI(JComponent c)
protected void
editablePropertyChanged(PropertyChangeEvent e)
Deprecated.As of Java 2 platform v1.4.int
getBaseline(JComponent c, int width, int height)
Returns the baseline.Dimension
getMinimumSize(JComponent c)
The minumum size is the size of the display area plus insets plus the button.void
layoutComboBox(Container parent, MetalComboBoxUI.MetalComboBoxLayoutManager manager)
void
paint(Graphics g, JComponent c)
Paints the specified component appropriately for the look and feel.void
paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
If necessary paints the currently selected item.void
paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
If necessary paints the background of the currently selected item.protected void
removeListeners()
Deprecated.As of Java 2 platform v1.4.void
unconfigureEditor()
This protected method is implementation specific and should be private.-
Methods inherited from class javax.swing.plaf.basic.BasicComboBoxUI
addEditor, configureArrowButton, createFocusListener, createItemListener, createKeyListener, createListDataListener, createRenderer, getAccessibleChild, getAccessibleChildrenCount, getBaselineResizeBehavior, getDefaultSize, getDisplaySize, getInsets, getMaximumSize, getPreferredSize, getSizeForComponent, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, isFocusTraversable, isNavigationKey, isPopupVisible, rectangleForCurrentValue, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
-
-
-
-
Method Detail
-
createUI
public static ComponentUI createUI(JComponent c)
-
paint
public void paint(Graphics g, JComponent c)
Description copied from class:ComponentUI
Paints the specified component appropriately for the look and feel. This method is invoked from theComponentUI.update
method when the specified component is being painted. Subclasses should override this method and use the specifiedGraphics
object to render the content of the component.- Overrides:
paint
in classBasicComboBoxUI
- Parameters:
g
- theGraphics
context in which to paintc
- the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components- See Also:
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
-
paintCurrentValue
public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
If necessary paints the currently selected item.- Overrides:
paintCurrentValue
in 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
public void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
If necessary paints the background of the currently selected item.- Overrides:
paintCurrentValueBackground
in 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
public int getBaseline(JComponent c, int width, int height)
Returns the baseline.- Overrides:
getBaseline
in classBasicComboBoxUI
- Parameters:
c
-JComponent
baseline 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
- ifc
isnull
IllegalArgumentException
- if width or height is < 0- Since:
- 1.6
- See Also:
JComponent.getBaseline(int, int)
-
createEditor
protected ComboBoxEditor createEditor()
Description copied from class:BasicComboBoxUI
Creates the default editor that will be used in editable combo boxes. A default editor will be used only if an editor has not been explicitly set withsetEditor
.- Overrides:
createEditor
in classBasicComboBoxUI
- Returns:
- a
ComboBoxEditor
used for the combo box - See Also:
JComboBox.setEditor(javax.swing.ComboBoxEditor)
-
createPopup
protected ComboPopup createPopup()
Description copied from class:BasicComboBoxUI
Creates the popup portion of the combo box.- Overrides:
createPopup
in classBasicComboBoxUI
- Returns:
- an instance of
ComboPopup
- See Also:
ComboPopup
-
createArrowButton
protected JButton createArrowButton()
Description copied from class:BasicComboBoxUI
Creates a button which will be used as the control to show or hide the popup portion of the combo box.- Overrides:
createArrowButton
in classBasicComboBoxUI
- Returns:
- a button which represents the popup control
-
createPropertyChangeListener
public PropertyChangeListener createPropertyChangeListener()
Description copied from class:BasicComboBoxUI
Creates aPropertyChangeListener
which will be added to the combo box. If this method returns null then it will not be added to the combo box.- Overrides:
createPropertyChangeListener
in classBasicComboBoxUI
- Returns:
- an instance of a
PropertyChangeListener
or null
-
editablePropertyChanged
@Deprecated protected void editablePropertyChanged(PropertyChangeEvent e)
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.
-
createLayoutManager
protected LayoutManager createLayoutManager()
Description copied from class:BasicComboBoxUI
Creates a layout manager for managing the components which make up the combo box.- Overrides:
createLayoutManager
in classBasicComboBoxUI
- Returns:
- an instance of a layout manager
-
layoutComboBox
public void layoutComboBox(Container parent, MetalComboBoxUI.MetalComboBoxLayoutManager manager)
-
removeListeners
@Deprecated protected void 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:BasicComboBoxUI
This protected method is implementation specific and should be private. do not call or override.- Overrides:
configureEditor
in classBasicComboBoxUI
- See Also:
BasicComboBoxUI.addEditor()
-
unconfigureEditor
public void unconfigureEditor()
Description copied from class:BasicComboBoxUI
This protected method is implementation specific and should be private. Do not call or override.- Overrides:
unconfigureEditor
in classBasicComboBoxUI
- See Also:
BasicComboBoxUI.addEditor()
-
getMinimumSize
public Dimension getMinimumSize(JComponent c)
Description copied from class:BasicComboBoxUI
The minumum size is the size of the display area plus insets plus the button.- Overrides:
getMinimumSize
in classBasicComboBoxUI
- Parameters:
c
- the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components- Returns:
- a
Dimension
object ornull
- See Also:
JComponent.getMinimumSize()
,LayoutManager.minimumLayoutSize(java.awt.Container)
,ComponentUI.getPreferredSize(javax.swing.JComponent)
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/plaf/metal/metalcomboboxui.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.