Class PlasticComboBoxButton

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

final class PlasticComboBoxButton extends JButton
The default button for combo boxes in the JGoodies Plastic Look&Feel.

It differs from MetalComboBoxButton in that the border is quite the same as for text fields: a compound border with an inner MarginBorder.

Also, we try to switch the ListCellRenderer to transparent, which works for most JComponent renderes including the BasicComboBoxRenderer.

Version:
$Revision: 1.13 $
  • Field Details

    • EMPTY_INSETS

      private static final Insets EMPTY_INSETS
    • EMPTY_BORDER

      private static final Border EMPTY_BORDER
    • LEFT_MARGIN

      private static final int LEFT_MARGIN
      See Also:
    • RIGHT_MARGIN

      private static final int RIGHT_MARGIN
      See Also:
    • listBox

      private final JList listBox
    • rendererPane

      private final CellRendererPane rendererPane
    • comboBox

      private JComboBox comboBox
    • comboIcon

      private Icon comboIcon
    • iconOnly

      private boolean iconOnly
    • borderPaintsFocus

      private final boolean borderPaintsFocus
  • Constructor Details

    • PlasticComboBoxButton

      PlasticComboBoxButton(JComboBox comboBox, Icon comboIcon, boolean iconOnly, CellRendererPane rendererPane, JList listBox)
      Constructs a PlasticComboBoxButton.
  • Method Details

    • getComboBox

      public JComboBox getComboBox()
    • setComboBox

      public void setComboBox(JComboBox cb)
    • getComboIcon

      public Icon getComboIcon()
    • setComboIcon

      public void setComboIcon(Icon i)
    • isIconOnly

      public boolean isIconOnly()
    • setIconOnly

      public void setIconOnly(boolean b)
    • setEnabled

      public void setEnabled(boolean enabled)
      Overrides:
      setEnabled in class AbstractButton
    • isFocusTraversable

      public boolean isFocusTraversable()
      The combo's arrow button should be excluded from the focus traversal. Since Java 6 the arrow button is configured as being focusable in BasicComboBoxUI#configureArrowButton. Therefore it doesn't help to call setFocusable(false) in the constructor; instead we override this method.
      Overrides:
      isFocusTraversable in class Component
    • paintComponent

      public void paintComponent(Graphics g)
      Paints the component; honors the 3D settings and tries to switch the renderer component to transparent.
      Overrides:
      paintComponent in class JComponent
    • configureColors

      private void configureColors(Component c)
    • is3D

      private boolean is3D()
      Checks and answers if we should paint a pseudo 3D effect.
    • isTableCellEditor

      private boolean isTableCellEditor()
      Checks and answers if this UI's combo has a client property that indicates that the combo is used as a table cell editor.
      Returns:
      true if the table cell editor client property is set to Boolean.TRUE, false otherwise