PlasticComboBoxUI (JGoodies Looks 2.6 API)
Date: 2014-02-27

com.jgoodies.looks.plastic

## Class PlasticComboBoxUI

- java.lang.Object
- - javax.swing.plaf.ComponentUI
  - - javax.swing.plaf.ComboBoxUI
    - - javax.swing.plaf.basic.BasicComboBoxUI
      - - javax.swing.plaf.metal.MetalComboBoxUI
        - - com.jgoodies.looks.plastic.PlasticComboBoxUI

-     public class PlasticComboBoxUI
      extends MetalComboBoxUI

  The JGoodies Plastic Look and Feel implementation of `ComboBoxUI`. Has the same height as text fields - unless you change the renderer.

  Also, this class offers to use the combo's popup prototype display value to compute the popup menu width. This is an optional feature of the JGoodies Plastic L&fs implemented via a client property key.

  Version:
    $Revision: 1.19 $
  Author:
    Karsten Lentzsch
  See Also:
    `Options.COMBO_POPUP_PROTOTYPE_DISPLAY_VALUE_KEY`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.swing.plaf.metal.MetalComboBoxUI

      `MetalComboBoxUI.MetalComboBoxLayoutManager, MetalComboBoxUI.MetalComboPopup, MetalComboBoxUI.MetalPropertyChangeListener`

    - ### 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, squareButton`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PlasticComboBoxUI()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected JButton` | `createArrowButton()` Creates and answers the arrow button that is to be used in the combo box.
    `protected ComboBoxEditor` | `createEditor()` Creates the editor that is to 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()`
    `PropertyChangeListener` | `createPropertyChangeListener()`
    `protected ListCellRenderer` | `createRenderer()` Creates the default renderer that will be used in a non-editiable combo box.
    `static ComponentUI` | `createUI(JComponent b)`
    `Dimension` | `getMinimumSize(JComponent c)` The minumum size is the size of the display area plus insets plus the button.
    `Dimension` | `getPreferredSize(JComponent c)` Delegates to #getMinimumSize(Component).
    `protected void` | `installListeners()`
    `void` | `installUI(JComponent c)`
    `protected boolean` | `isToolBarComboBox(JComponent c)` Checks and answers if this combo is in a tool bar.
    `protected Rectangle` | `rectangleForCurrentValue()` Returns the area that is reserved for drawing the currently selected item.
    `protected void` | `uninstallListeners()`
    `void` | `update(Graphics g, JComponent c)`

    - ### Methods inherited from class javax.swing.plaf.metal.MetalComboBoxUI

      `configureEditor, editablePropertyChanged, getBaseline, layoutComboBox, paint, paintCurrentValue, paintCurrentValueBackground, removeListeners, unconfigureEditor`

    - ### Methods inherited from class javax.swing.plaf.basic.BasicComboBoxUI

      `addEditor, configureArrowButton, createFocusListener, createItemListener, createKeyListener, createListDataListener, getAccessibleChild, getAccessibleChildrenCount, getBaselineResizeBehavior, getDefaultSize, getDisplaySize, getInsets, getMaximumSize, getSizeForComponent, installComponents, installDefaults, installKeyboardActions, isFocusTraversable, isNavigationKey, isPopupVisible, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallUI`

    - ### Methods inherited from class javax.swing.plaf.ComponentUI

      `contains`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PlasticComboBoxUI

          public PlasticComboBoxUI()

  - ### Method Detail

    - #### createUI

          public static ComponentUI createUI(JComponent b)

    - #### installUI

          public void installUI(JComponent c)

      Overrides:
        `installUI` in class `BasicComboBoxUI`

    - #### installListeners

          protected void installListeners()

      Overrides:
        `installListeners` in class `BasicComboBoxUI`

    - #### uninstallListeners

          protected void uninstallListeners()

      Overrides:
        `uninstallListeners` in class `BasicComboBoxUI`

    - #### createArrowButton

          protected JButton createArrowButton()

      Creates and answers the arrow button that is to be used in the combo box.

      Overridden to use a button that can have a pseudo 3D effect.

      Overrides:
        `createArrowButton` in class `MetalComboBoxUI`

    - #### createEditor

          protected ComboBoxEditor createEditor()

      Creates the editor that is to be used in editable combo boxes. This method only gets called if a custom editor has not already been installed in the JComboBox.
      Overrides:
        `createEditor` in class `MetalComboBoxUI`

    - #### createLayoutManager

          protected LayoutManager createLayoutManager()

      Creates a layout manager for managing the components which make up the combo box.

      Overriden to use a layout that has a fixed width arrow button.

      Overrides:
        `createLayoutManager` in class `MetalComboBoxUI`
      Returns:
        an instance of a layout manager

    - #### createPopup

          protected ComboPopup createPopup()

      Overrides:
        `createPopup` in class `MetalComboBoxUI`

    - #### createRenderer

          protected ListCellRenderer createRenderer()

      Creates the default renderer that will be used in a non-editiable combo box. A default renderer will used only if a renderer has not been explicitly set with `setRenderer`.

      This method differs from the superclass implementation in that it uses an empty border with wider left and right margins of 2 pixels instead of 1.

      Overrides:
        `createRenderer` in class `BasicComboBoxUI`
      Returns:
        a `ListCellRender` used for the combo box
      See Also:
        `JComboBox.setRenderer(javax.swing.ListCellRenderer<? super E>)`

    - #### getMinimumSize

          public Dimension getMinimumSize(JComponent c)

      The minumum size is the size of the display area plus insets plus the button.
      Overrides:
        `getMinimumSize` in class `MetalComboBoxUI`

    - #### getPreferredSize

          public Dimension getPreferredSize(JComponent c)

      Delegates to #getMinimumSize(Component). Overridden to return the same result in JDK 1.5 as in JDK 1.4.
      Overrides:
        `getPreferredSize` in class `BasicComboBoxUI`

    - #### rectangleForCurrentValue

          protected Rectangle rectangleForCurrentValue()

      Returns the area that is reserved for drawing the currently selected item.
      Overrides:
        `rectangleForCurrentValue` in class `BasicComboBoxUI`

    - #### update

          public void update(Graphics g,
                    JComponent c)

      Overrides:
        `update` in class `ComponentUI`

    - #### isToolBarComboBox

          protected boolean isToolBarComboBox(JComponent c)

      Checks and answers if this combo is in a tool bar.
      Parameters:
        `c` - the component to check
      Returns:
        true if in tool bar, false otherwise

    - #### createPropertyChangeListener

          public PropertyChangeListener createPropertyChangeListener()

      Overrides:
        `createPropertyChangeListener` in class `MetalComboBoxUI`

Copyright © 2001-2014 JGoodies Software GmbH. All Rights Reserved.