dsto.dfc.swing.controls
Class ToolButtonUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ButtonUI
          extended by javax.swing.plaf.basic.BasicButtonUI
              extended by dsto.dfc.swing.controls.ToolButtonUI

public class ToolButtonUI
extends BasicButtonUI

The UI for ToolButton in all L&F schemes.

Version:
$Revision$
Author:
Matthew Phillips
See Also:
ToolButton

Field Summary
protected  Border normalBorder
           
protected  Border pressedBorder
           
protected  Border rolloverBorder
           
protected  boolean showPressed
          Whether showing the button as pressed.
 
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
 
Constructor Summary
ToolButtonUI()
           
 
Method Summary
protected static Color brighten(Color c)
          Brighten a given colour by 10%.
protected  void clearTextShiftOffset()
          Override to prevent clearing offset when in pressed mode.
protected  Border getBorder(ToolButton button)
           
 void paint(Graphics g, JComponent c)
          Override BasicButtonUI.paint () to show pressed and rollover effects.
protected  void paintBorder(Graphics g, ToolButton button, Border border)
           
protected  void paintButtonPressed(Graphics g, AbstractButton b)
           
protected  void paintIcon(Graphics g, JComponent c, Rectangle iconRect)
          Need to override since BasicButtonUI.paintBorder () does not respect textShiftOffset unless it thinks button is pressed.
protected  void updateBorder(Insets margin)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
createButtonListener, createUI, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPreferredSize, getPropertyPrefix, getTextShiftOffset, installDefaults, installKeyboardActions, installListeners, installUI, paintFocus, paintText, paintText, setTextShiftOffset, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

normalBorder

protected Border normalBorder

pressedBorder

protected Border pressedBorder

rolloverBorder

protected Border rolloverBorder

showPressed

protected boolean showPressed
Whether showing the button as pressed.

Constructor Detail

ToolButtonUI

public ToolButtonUI()
Method Detail

updateBorder

protected void updateBorder(Insets margin)

paint

public void paint(Graphics g,
                  JComponent c)
Override BasicButtonUI.paint () to show pressed and rollover effects.

Overrides:
paint in class BasicButtonUI

getBorder

protected Border getBorder(ToolButton button)

paintIcon

protected void paintIcon(Graphics g,
                         JComponent c,
                         Rectangle iconRect)
Need to override since BasicButtonUI.paintBorder () does not respect textShiftOffset unless it thinks button is pressed. This is a slightly hacked version of the source from JDK 1.3.

Overrides:
paintIcon in class BasicButtonUI

paintBorder

protected void paintBorder(Graphics g,
                           ToolButton button,
                           Border border)

paintButtonPressed

protected void paintButtonPressed(Graphics g,
                                  AbstractButton b)
Overrides:
paintButtonPressed in class BasicButtonUI

clearTextShiftOffset

protected void clearTextShiftOffset()
Override to prevent clearing offset when in pressed mode. This jiggers BasicButtonUI.paint into working correctly.

Overrides:
clearTextShiftOffset in class BasicButtonUI

brighten

protected static Color brighten(Color c)
Brighten a given colour by 10%.



Copyright © 2008 Commonwealth of Australia