Class EmphasizedLabelUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.LabelUI
-
- javax.swing.plaf.basic.BasicLabelUI
-
- com.explodingpixels.macwidgets.plaf.EmphasizedLabelUI
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.util.EventListener
public class EmphasizedLabelUI extends javax.swing.plaf.basic.BasicLabelUI
A
While this UI delegate can be directly installed on existingBasicLabelUI
that paints a shadow under the text using the given shadow color, which helps emphasize the text. The UI delegate also provides a facility for drawing a different shadow color when the corresponding label's containingWindow
is unfocused.JLabel
s, it is recommended that you use theMacWidgetFactory.createEmphasizedLabel(String)
orMacWidgetFactory.makeEmphasizedLabel(JLabel, Color, Color, Color)
factory methods.Here's a close-up of an emphasized label:
-
-
Field Summary
Fields Modifier and Type Field Description static java.awt.Color
DEFAULT_DISABLED_FONT_COLOR
static java.awt.Color
DEFAULT_EMPHASIS_COLOR
static java.awt.Color
DEFAULT_FOCUSED_FONT_COLOR
static java.awt.Color
DEFAULT_UNFOCUSED_FONT_COLOR
-
Constructor Summary
Constructors Constructor Description EmphasizedLabelUI()
Creates anEmphasizedLabelUI
using the default colors.EmphasizedLabelUI(java.awt.Color focusedTextColor, java.awt.Color unfocusedTextColor, java.awt.Color emphasisColor)
Creates anEmphasizedLabelUI
using the given colors.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
installUI(javax.swing.JComponent c)
protected void
paintDisabledText(javax.swing.JLabel label, java.awt.Graphics g, java.lang.String s, int textX, int textY)
protected void
paintEnabledText(javax.swing.JLabel label, java.awt.Graphics g, java.lang.String s, int textX, int textY)
void
uninstallUI(javax.swing.JComponent c)
-
Methods inherited from class javax.swing.plaf.basic.BasicLabelUI
createUI, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installComponents, installDefaults, installKeyboardActions, installListeners, layoutCL, paint, propertyChange, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners
-
-
-
-
Field Detail
-
DEFAULT_EMPHASIS_COLOR
public static final java.awt.Color DEFAULT_EMPHASIS_COLOR
-
DEFAULT_FOCUSED_FONT_COLOR
public static final java.awt.Color DEFAULT_FOCUSED_FONT_COLOR
-
DEFAULT_UNFOCUSED_FONT_COLOR
public static final java.awt.Color DEFAULT_UNFOCUSED_FONT_COLOR
-
DEFAULT_DISABLED_FONT_COLOR
public static final java.awt.Color DEFAULT_DISABLED_FONT_COLOR
-
-
Constructor Detail
-
EmphasizedLabelUI
public EmphasizedLabelUI()
Creates anEmphasizedLabelUI
using the default colors.
-
EmphasizedLabelUI
public EmphasizedLabelUI(java.awt.Color focusedTextColor, java.awt.Color unfocusedTextColor, java.awt.Color emphasisColor)
Creates anEmphasizedLabelUI
using the given colors.- Parameters:
focusedTextColor
- the color to draw the text with when the parentWindow
has focus.unfocusedTextColor
- the color to draw the text with when the parentWindow
does not have focus.emphasisColor
- the color to draw the emphasis text with.
-
-
Method Detail
-
installUI
public void installUI(javax.swing.JComponent c)
- Overrides:
installUI
in classjavax.swing.plaf.basic.BasicLabelUI
-
uninstallUI
public void uninstallUI(javax.swing.JComponent c)
- Overrides:
uninstallUI
in classjavax.swing.plaf.basic.BasicLabelUI
-
paintEnabledText
protected void paintEnabledText(javax.swing.JLabel label, java.awt.Graphics g, java.lang.String s, int textX, int textY)
- Overrides:
paintEnabledText
in classjavax.swing.plaf.basic.BasicLabelUI
-
paintDisabledText
protected void paintDisabledText(javax.swing.JLabel label, java.awt.Graphics g, java.lang.String s, int textX, int textY)
- Overrides:
paintDisabledText
in classjavax.swing.plaf.basic.BasicLabelUI
-
-