CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.gui.plaf
Class CustomButtonUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ButtonUI
          extended by javax.swing.plaf.basic.BasicButtonUI
              extended by ch.randelshofer.gui.plaf.CustomButtonUI
All Implemented Interfaces:
PlafConstants

public class CustomButtonUI
extends javax.swing.plaf.basic.BasicButtonUI
implements PlafConstants

CustomButtonUI draws a BackdropBorder in the background of the button. This allows for easy visual customization of buttons.

Usage:

 JButton b = new JButton();
 b.setUI((ButtonUI) CustomButtonUI.createUI(b));
 b.setBorder(new BackdropBorder(....));
 

Version:
2.0 2006-09-24 Rewritten.
1.0 2001-10-16 Created.
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
 
Fields inherited from interface ch.randelshofer.gui.plaf.PlafConstants
ALL, CENTER, EAST, NONE, PROP_BEVEL, WEST
 
Constructor Summary
CustomButtonUI()
           
 
Method Summary
protected  javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
 void installDefaults(javax.swing.AbstractButton b)
           
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
           
protected  void paintButtonPressed(java.awt.Graphics g, javax.swing.AbstractButton b)
           
protected  void paintFocus(java.awt.Graphics g, javax.swing.AbstractButton b, java.awt.Rectangle viewRect, java.awt.Rectangle textRect, java.awt.Rectangle iconRect)
           
protected  void paintText(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle textRect, java.lang.String text)
           
 void uninstallDefaults(javax.swing.AbstractButton b)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPreferredSize, getPropertyPrefix, getTextShiftOffset, installKeyboardActions, installListeners, installUI, paintIcon, paintText, setTextShiftOffset, 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
 

Constructor Detail

CustomButtonUI

public CustomButtonUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

installDefaults

public void installDefaults(javax.swing.AbstractButton b)
Overrides:
installDefaults in class javax.swing.plaf.basic.BasicButtonUI

uninstallDefaults

public void uninstallDefaults(javax.swing.AbstractButton b)
Overrides:
uninstallDefaults in class javax.swing.plaf.basic.BasicButtonUI

createButtonListener

protected javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
Overrides:
createButtonListener in class javax.swing.plaf.basic.BasicButtonUI

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Overrides:
paint in class javax.swing.plaf.basic.BasicButtonUI

paintButtonPressed

protected void paintButtonPressed(java.awt.Graphics g,
                                  javax.swing.AbstractButton b)
Overrides:
paintButtonPressed in class javax.swing.plaf.basic.BasicButtonUI

paintFocus

protected void paintFocus(java.awt.Graphics g,
                          javax.swing.AbstractButton b,
                          java.awt.Rectangle viewRect,
                          java.awt.Rectangle textRect,
                          java.awt.Rectangle iconRect)
Overrides:
paintFocus in class javax.swing.plaf.basic.BasicButtonUI

paintText

protected void paintText(java.awt.Graphics g,
                         javax.swing.JComponent c,
                         java.awt.Rectangle textRect,
                         java.lang.String text)
Overrides:
paintText in class javax.swing.plaf.basic.BasicButtonUI

(c) Werner Randelshofer.
All rights reserved.