PlasticToggleButtonUI (JGoodies Looks 2.6 API)
Date: 2015-01-03

com.jgoodies.looks.plastic

## Class PlasticToggleButtonUI

- java.lang.Object
- - javax.swing.plaf.ComponentUI
  - - javax.swing.plaf.ButtonUI
    - - javax.swing.plaf.basic.BasicButtonUI
      - - javax.swing.plaf.basic.BasicToggleButtonUI
        - - javax.swing.plaf.metal.MetalToggleButtonUI
          - - com.jgoodies.looks.plastic.PlasticToggleButtonUI

-     public class PlasticToggleButtonUI
      extends MetalToggleButtonUI

  The JGoodies Plastic L&F implementation of `ToggleButtonUI`. It differs from its superclass in that it can add a pseudo 3D effect, and that the border can paint the focus.
  Version:
    $Revision: 1.10 $
  Author:
    Karsten Lentzsch

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `HTML_KEY`

    - ### Fields inherited from class javax.swing.plaf.metal.MetalToggleButtonUI

      `disabledTextColor, focusColor, selectColor`

    - ### Fields inherited from class javax.swing.plaf.basic.BasicButtonUI

      `defaultTextIconGap, defaultTextShiftOffset`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PlasticToggleButtonUI()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ComponentUI` | `createUI(JComponent b)`
    `void` | `installDefaults(AbstractButton b)` In addition to the superclass we check if the border paints the focus.
    `protected boolean` | `is3D(AbstractButton b)` Checks and answers if this button shall use a pseudo 3D effect.
    `protected boolean` | `isToolBarButton(AbstractButton b)` Checks and answers if this is button is in a tool bar.
    `void` | `paint(Graphics g, JComponent c)` Unlike the BasicToggleButtonUI.paint, we don't fill the content area; this has been done by the update method before.
    `protected void` | `paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect)` Paints the focus close to the button's border.
    `void` | `update(Graphics g, JComponent c)`

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

      `getDisabledTextColor, getFocusColor, getSelectColor, paintButtonPressed, paintIcon, paintText, uninstallDefaults`

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

      `getPropertyPrefix, getTextShiftOffset`

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

      `clearTextShiftOffset, createButtonListener, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPreferredSize, installKeyboardActions, installListeners, installUI, paintIcon, paintText, setTextShiftOffset, uninstallKeyboardActions, uninstallListeners, uninstallUI`

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

      `contains, getAccessibleChild, getAccessibleChildrenCount`

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

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

- - ### Field Detail

    - #### HTML_KEY

          protected static final String HTML_KEY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PlasticToggleButtonUI

          public PlasticToggleButtonUI()

  - ### Method Detail

    - #### createUI

          public static ComponentUI createUI(JComponent b)

    - #### installDefaults

          public void installDefaults(AbstractButton b)

      In addition to the superclass we check if the border paints the focus.
      Overrides:
        `installDefaults` in class `MetalToggleButtonUI`

    - #### update

          public void update(Graphics g,
                    JComponent c)

      Overrides:
        `update` in class `MetalToggleButtonUI`

    - #### paintFocus

          protected void paintFocus(Graphics g,
                        AbstractButton b,
                        Rectangle viewRect,
                        Rectangle textRect,
                        Rectangle iconRect)

      Paints the focus close to the button's border.
      Overrides:
        `paintFocus` in class `MetalToggleButtonUI`

    - #### paint

          public void paint(Graphics g,
                   JComponent c)

      Unlike the BasicToggleButtonUI.paint, we don't fill the content area; this has been done by the update method before.
      Overrides:
        `paint` in class `BasicToggleButtonUI`

    - #### isToolBarButton

          protected boolean isToolBarButton(AbstractButton b)

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

    - #### is3D

          protected boolean is3D(AbstractButton b)

      Checks and answers if this button shall use a pseudo 3D effect.
      Parameters:
        `b` - the button to check
      Returns:
        true indicates a 3D effect, false flat

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