Quaqua 5.4.1 2009-07-14

ch.randelshofer.quaqua
Class QuaquaCheckBoxUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ButtonUI
          extended by javax.swing.plaf.basic.BasicButtonUI
              extended by javax.swing.plaf.basic.BasicToggleButtonUI
                  extended by javax.swing.plaf.basic.BasicRadioButtonUI
                      extended by javax.swing.plaf.basic.BasicCheckBoxUI
                          extended by ch.randelshofer.quaqua.QuaquaCheckBoxUI
All Implemented Interfaces:
VisuallyLayoutable

public class QuaquaCheckBoxUI
extends javax.swing.plaf.basic.BasicCheckBoxUI
implements VisuallyLayoutable

QuaquaCheckBoxUI.

Version:
1.4 2006-06-05 Implemented workaround for Matisse GUI builder.
1.3 2006-04-08 Use small icon when used as a TableCellRenderer or as a TableCellEditor.
1.2.2 2006-02-04 Tweaked perceived text bounds.
1.2.1 2005-12-03 Renamed UIManager property "disabledText" to "disabledForeground".
1.2 2005-07-17 Adapted to changes in interface VisuallyLayoutable.
1.1 2005-06-19 Paint text antialiased.
1.0.1 2005-05-29 Fixed null pointer exception when no default icon is availabl.e
1.0 20 March 2005 Created.
Author:
Werner Randelshofer

Nested Class Summary
static class QuaquaCheckBoxUI.PropertyChangeHandler
          This inner class is marked "public" due to a compiler bug.
 
Field Summary
protected  javax.swing.Icon smallIcon
           
 
Fields inherited from class javax.swing.plaf.basic.BasicRadioButtonUI
icon
 
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
 
Fields inherited from interface ch.randelshofer.quaqua.VisuallyLayoutable
CLIP_BOUNDS, COMPONENT_BOUNDS, TEXT_BOUNDS
 
Constructor Summary
QuaquaCheckBoxUI()
           
 
Method Summary
protected  javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent b)
          Preferred spacing between check boxes and other components.
 int getBaseline(javax.swing.JComponent c, int width, int height)
          Returns the baseline for the specified component, or -1 if the baseline can not be determined.
 javax.swing.Icon getDefaultIcon(javax.swing.JComponent c)
           
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          The preferred size of the radio button
 java.awt.Rectangle getVisualBounds(javax.swing.JComponent c, int type, int width, int height)
          Returns the visual bounds for the specified component, or null if the visual bounds can not be determined.
protected  void installDefaults(javax.swing.AbstractButton b)
           
protected  void installListeners(javax.swing.AbstractButton b)
           
protected  java.lang.String layoutCL(javax.swing.AbstractButton c, java.awt.FontMetrics fontMetrics, java.lang.String text, javax.swing.Icon icon, java.awt.Rectangle viewR, java.awt.Rectangle iconR, java.awt.Rectangle textR)
          Forwards the call to SwingUtilities.layoutCompoundLabel().
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
           
protected  void paintFocus(java.awt.Graphics g, java.awt.Rectangle textRect, java.awt.Dimension size)
           
protected  void paintText(java.awt.Graphics g, javax.swing.AbstractButton b, java.awt.Rectangle textRect, java.lang.String text)
          Method which renders the text of the current button.
protected  void uninstallDefaults(javax.swing.AbstractButton b)
           
protected  void uninstallListeners(javax.swing.AbstractButton b)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicCheckBoxUI
getPropertyPrefix
 
Methods inherited from class javax.swing.plaf.basic.BasicRadioButtonUI
getDefaultIcon
 
Methods inherited from class javax.swing.plaf.basic.BasicToggleButtonUI
getTextShiftOffset, paintIcon
 
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getDefaultTextIconGap, getMaximumSize, getMinimumSize, installKeyboardActions, installUI, paintButtonPressed, paintFocus, paintIcon, paintText, setTextShiftOffset, uninstallKeyboardActions, 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

smallIcon

protected javax.swing.Icon smallIcon
Constructor Detail

QuaquaCheckBoxUI

public QuaquaCheckBoxUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent b)
Preferred spacing between check boxes and other components. / private final static Insets regularSpacing = new Insets(6,6,6,6); private final static Insets smallSpacing = new Insets(6,6,6,6); private final static Insets miniSpacing = new Insets(5,5,5,5);


installDefaults

protected void installDefaults(javax.swing.AbstractButton b)
Overrides:
installDefaults in class javax.swing.plaf.basic.BasicRadioButtonUI

uninstallDefaults

protected void uninstallDefaults(javax.swing.AbstractButton b)
Overrides:
uninstallDefaults in class javax.swing.plaf.basic.BasicRadioButtonUI

installListeners

protected void installListeners(javax.swing.AbstractButton b)
Overrides:
installListeners in class javax.swing.plaf.basic.BasicButtonUI

uninstallListeners

protected void uninstallListeners(javax.swing.AbstractButton b)
Overrides:
uninstallListeners 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

getDefaultIcon

public javax.swing.Icon getDefaultIcon(javax.swing.JComponent c)

paint

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

paintFocus

protected void paintFocus(java.awt.Graphics g,
                          java.awt.Rectangle textRect,
                          java.awt.Dimension size)
Overrides:
paintFocus in class javax.swing.plaf.basic.BasicRadioButtonUI

paintText

protected void paintText(java.awt.Graphics g,
                         javax.swing.AbstractButton b,
                         java.awt.Rectangle textRect,
                         java.lang.String text)
Method which renders the text of the current button.

Overrides:
paintText in class javax.swing.plaf.basic.BasicButtonUI
Parameters:
g - Graphics context
b - Current button to render
textRect - Bounding rectangle to render the text.
text - String to render
Since:
1.4

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
The preferred size of the radio button

Overrides:
getPreferredSize in class javax.swing.plaf.basic.BasicRadioButtonUI

layoutCL

protected java.lang.String layoutCL(javax.swing.AbstractButton c,
                                    java.awt.FontMetrics fontMetrics,
                                    java.lang.String text,
                                    javax.swing.Icon icon,
                                    java.awt.Rectangle viewR,
                                    java.awt.Rectangle iconR,
                                    java.awt.Rectangle textR)
Forwards the call to SwingUtilities.layoutCompoundLabel(). This method is here so that a subclass could do Label specific layout and to shorten the method name a little.

See Also:
SwingUtilities.layoutCompoundLabel(javax.swing.JComponent, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, int, int, int, int, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle, int)

getBaseline

public int getBaseline(javax.swing.JComponent c,
                       int width,
                       int height)
Description copied from interface: VisuallyLayoutable
Returns the baseline for the specified component, or -1 if the baseline can not be determined. The baseline is measured from the top of the component.

Specified by:
getBaseline in interface VisuallyLayoutable
Parameters:
c - JComponent to calculate baseline for
width - Width of the component to determine baseline for.
height - Height of the component to determine baseline for.
Returns:
baseline for the specified component

getVisualBounds

public java.awt.Rectangle getVisualBounds(javax.swing.JComponent c,
                                          int type,
                                          int width,
                                          int height)
Description copied from interface: VisuallyLayoutable
Returns the visual bounds for the specified component, or null if the visual bounds can not be determined.

Specified by:
getVisualBounds in interface VisuallyLayoutable
Parameters:
c - JComponent to calculate visual margin for
type - The type of the visual margin.
width - Width of the component
height - Height of the component
Returns:
The visual bounds in component coordinates.

Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.