com.jgoodies.looks.plastic
Class PlasticToggleButtonUI

java.lang.Object
  extended byjavax.swing.plaf.ComponentUI
      extended byjavax.swing.plaf.ButtonUI
          extended byjavax.swing.plaf.basic.BasicButtonUI
              extended byjavax.swing.plaf.basic.BasicToggleButtonUI
                  extended byjavax.swing.plaf.metal.MetalToggleButtonUI
                      extended bycom.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 it listens to the jgoodies.isNarrow property to choose an appropriate margin.

Version:
$Revision: 1.3 $
Author:
Karsten Lentzsch
See Also:
Options.IS_NARROW_KEY

Field Summary
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
PlasticToggleButtonUI()
           
 
Method Summary
static ComponentUI createUI(JComponent b)
           
 void installDefaults(AbstractButton b)
          Installs defaults and honors the client property isNarrow.
 void installListeners(AbstractButton b)
          Installs an extra listener for a change of the isNarrow property.
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 uninstallListeners(AbstractButton b)
          Uninstalls the extra listener for a change of the isNarrow property.
 void update(Graphics g, JComponent c)
           
 
Methods inherited from class javax.swing.plaf.metal.MetalToggleButtonUI
getDisabledTextColor, getFocusColor, getSelectColor, paintButtonPressed, paintText, uninstallDefaults
 
Methods inherited from class javax.swing.plaf.basic.BasicToggleButtonUI
getPropertyPrefix, getTextShiftOffset, paintIcon
 
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, createButtonListener, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPreferredSize, installKeyboardActions, installUI, paintIcon, paintText, setTextShiftOffset, uninstallKeyboardActions, 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)
Installs defaults and honors the client property isNarrow.


installListeners

public void installListeners(AbstractButton b)
Installs an extra listener for a change of the isNarrow property.


uninstallListeners

public void uninstallListeners(AbstractButton b)
Uninstalls the extra listener for a change of the isNarrow property.


update

public void update(Graphics g,
                   JComponent c)

paintFocus

protected void paintFocus(Graphics g,
                          AbstractButton b,
                          Rectangle viewRect,
                          Rectangle textRect,
                          Rectangle iconRect)
Paints the focus close to the button's border.


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.


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-2005 JGoodies Karsten Lentzsch. All Rights Reserved.