com.cbse.jeasy
Class JELabelUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.LabelUI
          extended by com.cbse.jeasy.JELabelUI
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

public class JELabelUI
extends javax.swing.plaf.LabelUI
implements java.beans.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.

Version:
1.77 01/23/03
Author:
Hans Muller

Field Summary
protected static JELabelUI labelUI
           
 
Constructor Summary
JELabelUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
           
static void drawString(java.awt.Graphics g, java.lang.String text, int underlinedChar, int x, int y)
          Draw a string with the graphics g at location (x,y) just like g.drawString would.
static void drawStringUnderlineCharAt(java.awt.Graphics g, java.lang.String text, int underlinedIndex, int x, int y)
          Draw a string with the graphics g at location ( x,y) just like g.drawString would.
 java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
           
 java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
           
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
           
protected  void installComponents(javax.swing.JLabel c)
           
protected  void installDefaults(javax.swing.JLabel c)
           
protected  void installKeyboardActions(javax.swing.JLabel l)
           
protected  void installListeners(javax.swing.JLabel c)
           
 void installUI(javax.swing.JComponent c)
           
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 g, javax.swing.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(javax.swing.JLabel l, java.awt.Graphics g, java.lang.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(javax.swing.JLabel l, java.awt.Graphics g, java.lang.String s, int textX, int textY)
          Paint clippedText at textX, textY with the labels foreground color.
 void propertyChange(java.beans.PropertyChangeEvent e)
           
protected  void uninstallComponents(javax.swing.JLabel c)
           
protected  void uninstallDefaults(javax.swing.JLabel c)
           
protected  void uninstallKeyboardActions(javax.swing.JLabel c)
           
protected  void uninstallListeners(javax.swing.JLabel c)
           
 void uninstallUI(javax.swing.JComponent c)
           
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

labelUI

protected static JELabelUI labelUI
Constructor Detail

JELabelUI

public JELabelUI()
Method Detail

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.

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(javax.swing.JLabel l,
                                java.awt.Graphics g,
                                java.lang.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(javax.swing.JLabel l,
                                 java.awt.Graphics g,
                                 java.lang.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(java.awt.Graphics g,
                  javax.swing.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 javax.swing.plaf.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 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Overrides:
getPreferredSize in class javax.swing.plaf.ComponentUI

getMinimumSize

public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
Overrides:
getMinimumSize in class javax.swing.plaf.ComponentUI

getMaximumSize

public java.awt.Dimension getMaximumSize(javax.swing.JComponent c)
Overrides:
getMaximumSize in class javax.swing.plaf.ComponentUI

installUI

public void installUI(javax.swing.JComponent c)
Overrides:
installUI in class javax.swing.plaf.ComponentUI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Overrides:
uninstallUI in class javax.swing.plaf.ComponentUI

installDefaults

protected void installDefaults(javax.swing.JLabel c)

installListeners

protected void installListeners(javax.swing.JLabel c)

installComponents

protected void installComponents(javax.swing.JLabel c)

installKeyboardActions

protected void installKeyboardActions(javax.swing.JLabel l)

uninstallDefaults

protected void uninstallDefaults(javax.swing.JLabel c)

uninstallListeners

protected void uninstallListeners(javax.swing.JLabel c)

uninstallComponents

protected void uninstallComponents(javax.swing.JLabel c)

uninstallKeyboardActions

protected void uninstallKeyboardActions(javax.swing.JLabel c)

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

drawString

public static void drawString(java.awt.Graphics g,
                              java.lang.String text,
                              int underlinedChar,
                              int x,
                              int y)
Draw a string with the graphics g at location (x,y) just like g.drawString would. The first occurrence of underlineChar in text will be underlined. The matching algorithm is not case sensitive.


drawStringUnderlineCharAt

public static void drawStringUnderlineCharAt(java.awt.Graphics g,
                                             java.lang.String text,
                                             int underlinedIndex,
                                             int x,
                                             int y)
Draw a string with the graphics g at location ( x,y) just like g.drawString would. The character at index underlinedIndex in text will be underlined. If index is beyond the bounds of text (including < 0), nothing will be underlined.

Parameters:
g - Graphics to draw with
text - String to draw
underlinedIndex - Index of character in text to underline
x - x coordinate to draw at
y - y coordinate to draw at
Since:
1.4