Quaqua 8.0 2011-10-02

ch.randelshofer.quaqua
Class QuaquaLabelUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.LabelUI
          extended by javax.swing.plaf.basic.BasicLabelUI
              extended by ch.randelshofer.quaqua.QuaquaLabelUI
All Implemented Interfaces:
VisuallyLayoutable, java.beans.PropertyChangeListener, java.util.EventListener

public class QuaquaLabelUI
extends javax.swing.plaf.basic.BasicLabelUI
implements VisuallyLayoutable

QuaquaLabelUI.

Version:
$Id: QuaquaLabelUI.java 414 2011-07-29 20:55:05Z wrandelshofer $
Author:
Werner Randelshofer

Field Summary
protected static QuaquaLabelUI labelUI
           
 
Fields inherited from interface ch.randelshofer.quaqua.VisuallyLayoutable
CLIP_BOUNDS, COMPONENT_BOUNDS, TEXT_BOUNDS
 
Constructor Summary
QuaquaLabelUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Preferred spacing between labels 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.
 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.JLabel b)
           
protected  java.lang.String layoutCL(javax.swing.JLabel label, 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 gr, javax.swing.JComponent c)
           
protected  void paintDisabledText(javax.swing.JLabel l, java.awt.Graphics g, java.lang.String s, int textX, int textY)
          Paint label with disabled text color.
protected  void paintEnabledText(javax.swing.JLabel l, java.awt.Graphics g, java.lang.String s, int textX, int textY)
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicLabelUI
getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installComponents, installKeyboardActions, installListeners, installUI, uninstallComponents, 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

labelUI

protected static final QuaquaLabelUI labelUI
Constructor Detail

QuaquaLabelUI

public QuaquaLabelUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Preferred spacing between labels and other components. Pixels from colon and associated controls (RadioButton, CheckBox) / private final static Insets associatedRegularSpacing = new Insets(8,8,8,8); private final static Insets associatedSmallSpacing = new Insets(6,6,6,6); private final static Insets associatedMiniSpacing = new Insets(5,5,5,5);


installDefaults

protected void installDefaults(javax.swing.JLabel b)
Overrides:
installDefaults in class javax.swing.plaf.basic.BasicLabelUI

paint

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

paintDisabledText

protected void paintDisabledText(javax.swing.JLabel l,
                                 java.awt.Graphics g,
                                 java.lang.String s,
                                 int textX,
                                 int textY)
Paint label with disabled text color.

Overrides:
paintDisabledText in class javax.swing.plaf.basic.BasicLabelUI
See Also:
paint(java.awt.Graphics, javax.swing.JComponent), paintEnabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int)

paintEnabledText

protected void paintEnabledText(javax.swing.JLabel l,
                                java.awt.Graphics g,
                                java.lang.String s,
                                int textX,
                                int textY)
Overrides:
paintEnabledText in class javax.swing.plaf.basic.BasicLabelUI

layoutCL

protected java.lang.String layoutCL(javax.swing.JLabel label,
                                    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.

Overrides:
layoutCL in class javax.swing.plaf.basic.BasicLabelUI
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
Overrides:
getBaseline in class javax.swing.plaf.basic.BasicLabelUI
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.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class javax.swing.plaf.basic.BasicLabelUI

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