站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Class BasicLabelUI - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

javax.swing.plaf.basic
Class BasicLabelUI

java.lang.Object
  |
  +--javax.swing.plaf.ComponentUI
        |
        +--javax.swing.plaf.LabelUI
              |
              +--javax.swing.plaf.basic.BasicLabelUI
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
           
 
Constructor Summary
BasicLabelUI()
           
 
Method Summary
static ComponentUI createUI(JComponent c)
           
 Dimension getMaximumSize(JComponent c)
           
 Dimension getMinimumSize(JComponent c)
           
 Dimension getPreferredSize(JComponent c)
           
protected  void installComponents(JLabel c)
           
protected  void installDefaults(JLabel c)
           
protected  void installKeyboardActions(JLabel l)
           
protected  void installListeners(JLabel c)
           
 void installUI(JComponent c)
           
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(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.
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 propertyChange(PropertyChangeEvent e)
          This method gets called when a bound property is changed.
protected  void uninstallComponents(JLabel c)
           
protected  void uninstallDefaults(JLabel c)
           
protected  void uninstallKeyboardActions(JLabel c)
           
protected  void uninstallListeners(JLabel c)
           
 void uninstallUI(JComponent c)
           
 
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 BasicLabelUI labelUI
Constructor Detail

BasicLabelUI

public BasicLabelUI()
Method Detail

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.
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)

paintEnabledText

protected void paintEnabledText(JLabel l,
                                Graphics g,
                                String s,
                                int textX,
                                int textY)
Paint clippedText at textX, textY with the labels foreground color.
See Also:
paint(java.awt.Graphics, javax.swing.JComponent), paintDisabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int)

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().
See Also:
paint(java.awt.Graphics, javax.swing.JComponent), paintEnabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int)

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
See Also:
paintEnabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int), paintDisabledText(javax.swing.JLabel, java.awt.Graphics, java.lang.String, int, int), layoutCL(javax.swing.JLabel, java.awt.FontMetrics, java.lang.String, javax.swing.Icon, java.awt.Rectangle, java.awt.Rectangle, java.awt.Rectangle)

getPreferredSize

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

getMinimumSize

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

getMaximumSize

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

installUI

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

uninstallUI

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

installDefaults

protected void installDefaults(JLabel c)

installListeners

protected void installListeners(JLabel c)

installComponents

protected void installComponents(JLabel c)

installKeyboardActions

protected void installKeyboardActions(JLabel l)

uninstallDefaults

protected void uninstallDefaults(JLabel c)

uninstallListeners

protected void uninstallListeners(JLabel c)

uninstallComponents

protected void uninstallComponents(JLabel c)

uninstallKeyboardActions

protected void uninstallKeyboardActions(JLabel c)

createUI

public static ComponentUI createUI(JComponent c)

propertyChange

public void propertyChange(PropertyChangeEvent e)
Description copied from interface: PropertyChangeListener
This method gets called when a bound property is changed.
Specified by:
propertyChange in interface PropertyChangeListener
Tags copied from interface: PropertyChangeListener
Parameters:
evt - A PropertyChangeEvent object describing the event source and the property that has changed.

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.