This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.plaf.basic
class BasicLabelUI

java.lang.Object extended by javax.swing.plaf.ComponentUI extended by javax.swing.plaf.LabelUI extended by javax.swing.plaf.basic.BasicLabelUI
All Implemented Interfaces:
PropertyChangeListener
Direct Known Subclasses:
MetalLabelUI

public class BasicLabelUI
extends LabelUI
implements PropertyChangeListener

A Windows L&F implementation of LabelUI. This implementation is completely static, i.e. there's only one UIView implementation that's shared by all JLabel objects.


Field Summary
protected static BasicLabelUI labelUI
          The default BasicLabelUI instance.
 
Constructor Summary

          
 
Method Summary
static ComponentUI

          
 int
getBaseline(JComponent c, int width, int height)

          Returns the baseline.
 Component.BaselineResizeBehavior

          Returns an enum indicating how the baseline of the component changes as the size changes.
 Dimension

          Returns the specified component's maximum size appropriate for the look and feel.
 Dimension

          Returns the specified component's minimum size appropriate for the look and feel.
 Dimension

          Returns the specified component's preferred size appropriate for the look and feel.
protected void

          
protected void

          
protected void

          
protected void

          
 void

          Configures the specified component appropriate for the look and feel.
protected String
layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)

          Forwards the call to SwingUtilities.layoutCompoundLabel().
 void

          Paint the label text in the foreground color, if the label is opaque then paint the entire background with the background color.
protected void
paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY)

          Paint clippedText at textX, textY with background.lighter() and then shifted down and to the right by one pixel with background.darker().
protected void
paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY)

          Paint clippedText at textX, textY with the labels foreground color.
 void

          
protected void

          
protected void

          
protected void

          
protected void

          
 void

          Reverses configuration which was done on the specified component during installUI.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

labelUI

protected static BasicLabelUI labelUI
The default BasicLabelUI instance. This field might not be used. To change the default instance use a subclass which overrides the createUI method, and place that class name in defaults table under the key "LabelUI".
Constructor Detail

BasicLabelUI

public BasicLabelUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent c)
Parameters:
c

getBaseline

public int getBaseline(JComponent c,
                       int width,
                       int height)
Returns the baseline.

Overrides:
getBaseline in class ComponentUI
Parameters:
c
width
height

getBaselineResizeBehavior

public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
Returns an enum indicating how the baseline of the component changes as the size changes.

Overrides:
getBaselineResizeBehavior in class ComponentUI
Parameters:
c

getMaximumSize

public Dimension getMaximumSize(JComponent c)
Overrides:
getMaximumSize in class ComponentUI
Parameters:
c
Returns:
getPreferredSize(c)

getMinimumSize

public Dimension getMinimumSize(JComponent c)
Overrides:
getMinimumSize in class ComponentUI
Parameters:
c
Returns:
getPreferredSize(c)

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Overrides:
getPreferredSize in class ComponentUI
Parameters:
c

installComponents

protected void installComponents(JLabel c)
Parameters:
c

installDefaults

protected void installDefaults(JLabel c)
Parameters:
c

installKeyboardActions

protected void installKeyboardActions(JLabel l)
Parameters:
l

installListeners

protected void installListeners(JLabel c)
Parameters:
c

installUI

public void installUI(JComponent c)
Overrides:
installUI in class ComponentUI
Parameters:
c

layoutCL

protected String layoutCL(JLabel label,
                          FontMetrics fontMetrics,
                          String text,
                          Icon icon,
                          Rectangle viewR,
                          Rectangle iconR,
                          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.

Parameters:
label
fontMetrics
text
icon
viewR
iconR
textR

paint

public void paint(Graphics g,
                  JComponent c)
Paint the label text in the foreground color, if the label is opaque then paint the entire background with the background color. The Label text is drawn by paintEnabledText() or paintDisabledText(). The locations of the label parts are computed by layoutCL.

Overrides:
paint in class ComponentUI
Parameters:
g
c

paintDisabledText

protected void paintDisabledText(JLabel l,
                                 Graphics g,
                                 String s,
                                 int textX,
                                 int textY)
Paint clippedText at textX, textY with background.lighter() and then shifted down and to the right by one pixel with background.darker().

Parameters:
l
g
s
textX
textY

paintEnabledText

protected void paintEnabledText(JLabel l,
                                Graphics g,
                                String s,
                                int textX,
                                int textY)
Paint clippedText at textX, textY with the labels foreground color.

Parameters:
l
g
s
textX
textY

propertyChange

public void propertyChange(PropertyChangeEvent e)
Parameters:
e

uninstallComponents

protected void uninstallComponents(JLabel c)
Parameters:
c

uninstallDefaults

protected void uninstallDefaults(JLabel c)
Parameters:
c

uninstallKeyboardActions

protected void uninstallKeyboardActions(JLabel c)
Parameters:
c

uninstallListeners

protected void uninstallListeners(JLabel c)
Parameters:
c

uninstallUI

public void uninstallUI(JComponent c)
Overrides:
uninstallUI in class ComponentUI
Parameters:
c


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.