com.alee.laf.label
Class WebLabelUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.LabelUI
          extended by javax.swing.plaf.basic.BasicLabelUI
              extended by com.alee.laf.label.WebLabelUI
All Implemented Interfaces:
Styleable, BorderMethods, SwingMethods, java.beans.PropertyChangeListener, java.util.EventListener
Direct Known Subclasses:
WebVerticalLabelUI

public class WebLabelUI
extends javax.swing.plaf.basic.BasicLabelUI
implements Styleable, BorderMethods

Custom UI for JLabel component.

Author:
Mikle Garin

Field Summary
protected  boolean drawShade
           
protected  javax.swing.JLabel label
           
protected  java.awt.Insets margin
          Style settings.
protected  LabelPainter painter
          Component painter.
protected  java.beans.PropertyChangeListener propertyChangeListener
          Label listeners.
protected  java.lang.String styleId
          Runtime variables.
 
Fields inherited from class javax.swing.plaf.basic.BasicLabelUI
labelUI
 
Constructor Summary
WebLabelUI()
           
 
Method Summary
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the WebLabelUI for the specified component.
 java.awt.Insets getMargin()
          Returns component margin.
 Painter getPainter()
          Returns label painter.
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
          
 java.awt.Color getShadeColor()
          Returns text shade color.
 java.lang.String getStyleId()
          Returns component style ID.
 java.lang.Float getTransparency()
          Returns label transparency.
 void installUI(javax.swing.JComponent c)
          Installs UI in the specified component.
 boolean isDrawShade()
          Returns whether text shade is displayed or not.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paints label.
 void setDrawShade(boolean drawShade)
          Sets whether text shade should be displayed or not.
 void setMargin(java.awt.Insets margin)
          Sets component margin.
 void setPainter(Painter painter)
          Sets label painter.
 void setShadeColor(java.awt.Color shadeColor)
          Sets text shade color.
 void setStyleId(java.lang.String id)
          Sets custom component style ID.
 void setTransparency(java.lang.Float transparency)
          Sets label transparency.
 void uninstallUI(javax.swing.JComponent c)
          Uninstalls UI from the specified component.
 void updateBorder()
          Updates custom WebLaF border.
 
Methods inherited from class javax.swing.plaf.basic.BasicLabelUI
getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, installComponents, installDefaults, installKeyboardActions, installListeners, layoutCL, paintDisabledText, paintEnabledText, propertyChange, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners
 
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

margin

protected java.awt.Insets margin
Style settings.


drawShade

protected boolean drawShade

painter

protected LabelPainter painter
Component painter.


propertyChangeListener

protected java.beans.PropertyChangeListener propertyChangeListener
Label listeners.


styleId

protected java.lang.String styleId
Runtime variables.


label

protected javax.swing.JLabel label
Constructor Detail

WebLabelUI

public WebLabelUI()
Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the WebLabelUI for the specified component. This tricky method is used by UIManager to create component UIs when needed.

Parameters:
c - component that will use UI instance
Returns:
instance of the WebLabelUI

installUI

public void installUI(javax.swing.JComponent c)
Installs UI in the specified component.

Overrides:
installUI in class javax.swing.plaf.basic.BasicLabelUI
Parameters:
c - component for this UI

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Uninstalls UI from the specified component.

Overrides:
uninstallUI in class javax.swing.plaf.basic.BasicLabelUI
Parameters:
c - component with this UI

getStyleId

public java.lang.String getStyleId()
Returns component style ID. Custom ID can be specified to override default component style using "setStyleId" method. If style for such custom ID is not found in skin descriptor then default style for that component is used.

Specified by:
getStyleId in interface Styleable
Returns:
component style ID

setStyleId

public void setStyleId(java.lang.String id)
Sets custom component style ID. If style for such custom ID is not found in skin descriptor default style will be used for that component. This method forces component to instantly use component style with the specified ID.

Specified by:
setStyleId in interface Styleable
Parameters:
id - custom component style ID

updateBorder

public void updateBorder()
Updates custom WebLaF border.

Specified by:
updateBorder in interface BorderMethods

isDrawShade

public boolean isDrawShade()
Returns whether text shade is displayed or not.

Returns:
true if text shade is displayed, false otherwise

setDrawShade

public void setDrawShade(boolean drawShade)
Sets whether text shade should be displayed or not.

Parameters:
drawShade - whether text shade should be displayed or not

getMargin

public java.awt.Insets getMargin()
Returns component margin.

Returns:
component margin

setMargin

public void setMargin(java.awt.Insets margin)
Sets component margin.

Parameters:
margin - component margin

getShadeColor

public java.awt.Color getShadeColor()
Returns text shade color.

Returns:
text shade color

setShadeColor

public void setShadeColor(java.awt.Color shadeColor)
Sets text shade color.

Parameters:
shadeColor - text shade color

getTransparency

public java.lang.Float getTransparency()
Returns label transparency.

Returns:
label transparency

setTransparency

public void setTransparency(java.lang.Float transparency)
Sets label transparency.

Parameters:
transparency - label transparency

getPainter

public Painter getPainter()
Returns label painter.

Returns:
label painter

setPainter

public void setPainter(Painter painter)
Sets label painter. Pass null to remove label painter.

Parameters:
painter - new label painter

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paints label.

Overrides:
paint in class javax.swing.plaf.basic.BasicLabelUI
Parameters:
g - graphics
c - component

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)

Overrides:
getPreferredSize in class javax.swing.plaf.basic.BasicLabelUI