Get Bounce at SourceForge.net. Fast secure and Free Open Source software downloads

org.bounce.plaf
Class BounceButtonUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ButtonUI
          extended by javax.swing.plaf.basic.BasicButtonUI
              extended by org.bounce.plaf.BounceButtonUI
Direct Known Subclasses:
LinkButtonUI

public class BounceButtonUI
extends javax.swing.plaf.basic.BasicButtonUI

BounceButtonUI implementation.

Version:
$Revision: 1.4 $, $Date: 2008/01/28 21:28:37 $
Author:
Edwin Dankert

Field Summary
 
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
 
Constructor Summary
BounceButtonUI()
           
 
Method Summary
protected  javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
          Overrides the createButtonListener method in the BasicButtonUI class, to be able to install a new button listener that can listen to double clicks.
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Return this button look and feel.
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          Returns the preferred size of the button, this size will return the full width of the text as the preferred width and the full height of the lines as the height.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Overrides the paint method in the BasicButtonUI class.
protected  void paintBackground(java.awt.Graphics g, javax.swing.JComponent c)
          Paints button's background.
protected  void paintFocus(java.awt.Graphics g, QButton b, java.awt.Rectangle viewRect, java.awt.Rectangle textRect, java.awt.Rectangle iconRect)
          Paints the focus rectangle on the button.
protected  void paintIcon(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle iconRect, javax.swing.Icon icon)
          Paints the icon for the button.
protected  void paintText(java.awt.Graphics g, javax.swing.JComponent c, java.awt.Rectangle textRect, java.lang.String[] text)
          Paints the text on the button.
 
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPropertyPrefix, getTextShiftOffset, installDefaults, installKeyboardActions, installListeners, installUI, paintButtonPressed, paintFocus, paintIcon, 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
 

Constructor Detail

BounceButtonUI

public BounceButtonUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Return this button look and feel.

Parameters:
c - the component the look and feel is for, normally a QButton.
Returns:
the ui for the component.

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Overrides the paint method in the BasicButtonUI class.

Overrides:
paint in class javax.swing.plaf.basic.BasicButtonUI
Parameters:
g - the graphics.
c - the button component.

paintIcon

protected void paintIcon(java.awt.Graphics g,
                         javax.swing.JComponent c,
                         java.awt.Rectangle iconRect,
                         javax.swing.Icon icon)
Paints the icon for the button.

Parameters:
g - the graphics.
c - the button component.
iconRect - the rectangle the icon has to be painted in.
icon - the icon.

paintBackground

protected void paintBackground(java.awt.Graphics g,
                               javax.swing.JComponent c)
Paints button's background.

Parameters:
g - the graphics.
c - the button component.

paintFocus

protected void paintFocus(java.awt.Graphics g,
                          QButton b,
                          java.awt.Rectangle viewRect,
                          java.awt.Rectangle textRect,
                          java.awt.Rectangle iconRect)
Paints the focus rectangle on the button.

Parameters:
g - the graphics.
b - the button component.
viewRect - the whole button rectangle.
textRect - the text rectangle.
iconRect - the icon rectangle.

paintText

protected void paintText(java.awt.Graphics g,
                         javax.swing.JComponent c,
                         java.awt.Rectangle textRect,
                         java.lang.String[] text)
Paints the text on the button.

Parameters:
g - the graphics.
c - the button component.
textRect - the text rectangle.
text - the text to be painted.

createButtonListener

protected javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
Overrides the createButtonListener method in the BasicButtonUI class, to be able to install a new button listener that can listen to double clicks.

Overrides:
createButtonListener in class javax.swing.plaf.basic.BasicButtonUI
Parameters:
b - the button component.
Returns:
the button listener.

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Returns the preferred size of the button, this size will return the full width of the text as the preferred width and the full height of the lines as the height.

This method is a revamped version of the method:
BasicButtonUI.getPreferredSize()

Overrides:
getPreferredSize in class javax.swing.plaf.basic.BasicButtonUI
Parameters:
c - the button component.
Returns:
the preferred size of the button.

Get Bounce at SourceForge.net. Fast secure and Free Open Source software downloads

Copyright 2002-2002-2009 Edwin Dankert. All Rights Reserved.