Package org.jdesktop.swingx.renderer
Class LabelProvider
- java.lang.Object
-
- org.jdesktop.swingx.renderer.ComponentProvider<javax.swing.JLabel>
-
- org.jdesktop.swingx.renderer.LabelProvider
-
- All Implemented Interfaces:
java.io.Serializable
,UIDependent
public class LabelProvider extends ComponentProvider<javax.swing.JLabel>
A component provider which uses aJLabel
as rendering component.It configures the Label's text and icon property from the StringValue.
- Author:
- Jeanette Winzenburg
- See Also:
StringValue
,FormatStringValue
,IconValue
, Serialized Form
-
-
Field Summary
-
Fields inherited from class org.jdesktop.swingx.renderer.ComponentProvider
alignment, defaultVisuals, formatter, rendererComponent
-
-
Constructor Summary
Constructors Constructor Description LabelProvider()
Instantiates a LabelProvider with default to-String converter and LEADING horizontal alignment .LabelProvider(int alignment)
Instantiates a LabelProvider with default to-String converter and given horizontal alignment.LabelProvider(StringValue converter)
Instantiates a LabelProvider with the given to-String converter and LEADING horizontal alignment.LabelProvider(StringValue converter, int alignment)
Instantiates a LabelProvider with given to-String converter and given horizontal alignment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
configureState(CellContext context)
Configures the rendering component's state from the given cell context.protected javax.swing.JLabel
createRendererComponent()
Factory method to create and return the component to use for rendering.protected void
format(CellContext context)
Formats the renderering component's content from the given cell context.-
Methods inherited from class org.jdesktop.swingx.renderer.ComponentProvider
configureContent, configureVisuals, createDefaultVisuals, getDefaultVisuals, getHorizontalAlignment, getRendererComponent, getString, getStringValue, getValueAsIcon, getValueAsString, setHorizontalAlignment, setStringValue, updateUI
-
-
-
-
Constructor Detail
-
LabelProvider
public LabelProvider()
Instantiates a LabelProvider with default to-String converter and LEADING horizontal alignment .
-
LabelProvider
public LabelProvider(StringValue converter)
Instantiates a LabelProvider with the given to-String converter and LEADING horizontal alignment. If the converter is null, the default TO_STRING is used.- Parameters:
converter
- the converter to use for mapping the cell value to a String representation.
-
LabelProvider
public LabelProvider(int alignment)
Instantiates a LabelProvider with default to-String converter and given horizontal alignment.- Parameters:
alignment
- the horizontal alignment.
-
LabelProvider
public LabelProvider(StringValue converter, int alignment)
Instantiates a LabelProvider with given to-String converter and given horizontal alignment. If the converter is null, the default TO_STRING is used.- Parameters:
converter
- the converter to use for mapping the cell value to a String representation.alignment
- the horizontal alignment.
-
-
Method Detail
-
createRendererComponent
protected javax.swing.JLabel createRendererComponent()
Factory method to create and return the component to use for rendering.- Specified by:
createRendererComponent
in classComponentProvider<javax.swing.JLabel>
- Returns:
- the component to use for rendering.
-
configureState
protected void configureState(CellContext context)
Configures the rendering component's state from the given cell context. Here: sets the Label's horizontal alignment to the alignment as configured in the controller.- Specified by:
configureState
in classComponentProvider<javax.swing.JLabel>
- Parameters:
context
- the cell context to configure from, must not be null.
-
format
protected void format(CellContext context)
Formats the renderering component's content from the given cell context. Here: sets the labels's text and icon property to the value as returned by getValueAsString/Icon, respectively.- Specified by:
format
in classComponentProvider<javax.swing.JLabel>
- Parameters:
context
- the cellContext to use- See Also:
ComponentProvider.getValueAsString(CellContext)
,ComponentProvider.getValueAsIcon(CellContext)
-
-