org.globus.tools.ui.swing
Class MultiLineLabelUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.LabelUI
          extended by javax.swing.plaf.basic.BasicLabelUI
              extended by org.globus.tools.ui.swing.MultiLineLabelUI
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class MultiLineLabelUI
extends BasicLabelUI


Field Summary
protected  String str
           
protected  String[] strs
           
 
Fields inherited from class javax.swing.plaf.basic.BasicLabelUI
labelUI
 
Constructor Summary
MultiLineLabelUI()
           
 
Method Summary
static Dimension computeMultiLineDimension(FontMetrics fm, String[] strs)
           
protected  void drawString(Graphics g, String s, int accChar, int textX, int textY)
           
protected  String layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR)
           
static String layoutCompoundLabel(FontMetrics fm, String[] text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap)
          Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string.
static String layoutCompoundLabel(JComponent c, FontMetrics fm, String[] text, Icon icon, int verticalAlignment, int horizontalAlignment, int verticalTextPosition, int horizontalTextPosition, Rectangle viewR, Rectangle iconR, Rectangle textR, int textIconGap)
          Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string.
protected  void paintDisabledText(JLabel l, Graphics g, String s, int textX, int textY)
           
protected  void paintEnabledText(JLabel l, Graphics g, String s, int textX, int textY)
           
 String[] splitStringByLines(String str)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicLabelUI
createUI, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, paint, propertyChange, 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

str

protected String str

strs

protected String[] strs
Constructor Detail

MultiLineLabelUI

public MultiLineLabelUI()
Method Detail

layoutCL

protected String layoutCL(JLabel label,
                          FontMetrics fontMetrics,
                          String text,
                          Icon icon,
                          Rectangle viewR,
                          Rectangle iconR,
                          Rectangle textR)
Overrides:
layoutCL in class BasicLabelUI

layoutCompoundLabel

public static String layoutCompoundLabel(JComponent c,
                                         FontMetrics fm,
                                         String[] text,
                                         Icon icon,
                                         int verticalAlignment,
                                         int horizontalAlignment,
                                         int verticalTextPosition,
                                         int horizontalTextPosition,
                                         Rectangle viewR,
                                         Rectangle iconR,
                                         Rectangle textR,
                                         int textIconGap)
Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. Locations are computed relative to the viewR rectangle. The JComponents orientation (LEADING/TRAILING) will also be taken into account and translated into LEFT/RIGHT values accordingly.


layoutCompoundLabel

public static String layoutCompoundLabel(FontMetrics fm,
                                         String[] text,
                                         Icon icon,
                                         int verticalAlignment,
                                         int horizontalAlignment,
                                         int verticalTextPosition,
                                         int horizontalTextPosition,
                                         Rectangle viewR,
                                         Rectangle iconR,
                                         Rectangle textR,
                                         int textIconGap)
Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. Locations are computed relative to the viewR rectangle. This layoutCompoundLabel() does not know how to handle LEADING/TRAILING values in horizontalTextPosition (they will default to RIGHT) and in horizontalAlignment (they will default to CENTER). Use the other version of layoutCompoundLabel() instead.


paintEnabledText

protected void paintEnabledText(JLabel l,
                                Graphics g,
                                String s,
                                int textX,
                                int textY)
Overrides:
paintEnabledText in class BasicLabelUI

paintDisabledText

protected void paintDisabledText(JLabel l,
                                 Graphics g,
                                 String s,
                                 int textX,
                                 int textY)
Overrides:
paintDisabledText in class BasicLabelUI

drawString

protected void drawString(Graphics g,
                          String s,
                          int accChar,
                          int textX,
                          int textY)

computeMultiLineDimension

public static Dimension computeMultiLineDimension(FontMetrics fm,
                                                  String[] strs)

splitStringByLines

public String[] splitStringByLines(String str)