Package com.jidesoft.plaf.basic
Class BasicStyledLabelUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.LabelUI
javax.swing.plaf.basic.BasicLabelUI
com.jidesoft.plaf.basic.BasicStyledLabelUI
- All Implemented Interfaces:
PropertyChangeListener,EventListener,SwingConstants
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Comparator<StyleRange> protected static BasicStyledLabelUIFields inherited from class javax.swing.plaf.basic.BasicLabelUI
labelUIFields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildStyledText(StyledLabel label) static ComponentUIprotected FontgetFont(StyledLabel label) Gets the font from the label.protected DimensiongetPreferredSize(StyledLabel label) Gets the preferred size of the text portion of the StyledLabel including the icon.protected StringlayoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR) static StringlayoutCompoundLabel(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 StringlayoutCompoundLabel(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 voidpaintDisabledText(JLabel l, Graphics g, String s, int textX, int textY) protected voidpaintEnabledText(JLabel l, Graphics g, String s, int textX, int textY) protected voidpaintStyledText(StyledLabel label, Graphics g, int textX, int textY) voidMethods inherited from class javax.swing.plaf.basic.BasicLabelUI
getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, paint, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUIMethods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
-
Field Details
-
_comparator
-
styledLabelUI
-
-
Constructor Details
-
BasicStyledLabelUI
public BasicStyledLabelUI()
-
-
Method Details
-
createUI
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classBasicLabelUI
-
paintEnabledText
- Overrides:
paintEnabledTextin classBasicLabelUI
-
paintDisabledText
- Overrides:
paintDisabledTextin classBasicLabelUI
-
buildStyledText
-
getPreferredSize
- Overrides:
getPreferredSizein classBasicLabelUI
-
layoutCL
protected String layoutCL(JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR) - Overrides:
layoutCLin classBasicLabelUI
-
getPreferredSize
Gets the preferred size of the text portion of the StyledLabel including the icon.- Parameters:
label- the StyledLabel- Returns:
- the preferred size.
-
getFont
Gets the font from the label.- Parameters:
label- the label.- Returns:
- the font. If label's getFont is null, we will use Label.font instead.
-
paintStyledText
-
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.- Parameters:
c- the componentfm- the font metricstext- the texticon- the iconverticalAlignment- vertical alignment modehorizontalAlignment- horizontal alignment modeverticalTextPosition- vertical text positionhorizontalTextPosition- horizontal text positionviewR- view rectangleiconR- icon rectangletextR- text rectangletextIconGap- the gap between text and icon- Returns:
- the layout string
-
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.- Parameters:
fm- the font metricstext- the texticon- the iconverticalAlignment- vertical alignment modehorizontalAlignment- horizontal alignment modeverticalTextPosition- vertical text positionhorizontalTextPosition- horizontal text positionviewR- view rectangleiconR- icon rectangletextR- text rectangletextIconGap- the gap between text and icon- Returns:
- the layout string
-