org.jfree.chart.block

Class LabelBlock

Implemented Interfaces:
Block, Cloneable, Drawable, PublicCloneable, Serializable

public class LabelBlock
extends AbstractBlock
implements Block, PublicCloneable

A block containing a label.

Field Summary

static Paint
DEFAULT_PAINT
The default color.

Constructor Summary

LabelBlock(String label)
Creates a new label block.
LabelBlock(String text, Font font)
Creates a new label block.
LabelBlock(String text, Font font, Paint paint)
Creates a new label block.

Method Summary

Size2D
arrange(Graphics2D g2, RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and returns the block size.
Object
clone()
Returns a clone of this LabelBlock instance.
void
draw(Graphics2D g2, Rectangle2D area)
Draws the block.
Object
draw(Graphics2D g2, Rectangle2D area, Object params)
Draws the block within the specified area.
boolean
equals(Object obj)
Tests this LabelBlock for equality with an arbitrary object.
Font
getFont()
Returns the font.
Paint
getPaint()
Returns the paint.
String
getToolTipText()
Returns the tool tip text.
String
getURLText()
Returns the URL text.
void
setFont(Font font)
Sets the font and regenerates the label.
void
setPaint(Paint paint)
Sets the paint and regenerates the label.
void
setToolTipText(String text)
Sets the tool tip text.
void
setURLText(String text)
Sets the URL text.

Methods inherited from class org.jfree.chart.block.AbstractBlock

arrange, arrange, calculateTotalHeight, calculateTotalWidth, clone, drawBorder, equals, getBorder, getBounds, getContentXOffset, getContentYOffset, getFrame, getHeight, getID, getMargin, getPadding, getWidth, setBorder, setBorder, setBounds, setFrame, setHeight, setID, setMargin, setMargin, setPadding, setPadding, setWidth, toContentConstraint, trimBorder, trimMargin, trimPadding, trimToContentHeight, trimToContentWidth

Field Details

DEFAULT_PAINT

public static final Paint DEFAULT_PAINT
The default color.

Constructor Details

LabelBlock

public LabelBlock(String label)
Creates a new label block.
Parameters:
label - the label (null not permitted).

LabelBlock

public LabelBlock(String text,
                  Font font)
Creates a new label block.
Parameters:
text - the text for the label (null not permitted).
font - the font (null not permitted).

LabelBlock

public LabelBlock(String text,
                  Font font,
                  Paint paint)
Creates a new label block.
Parameters:
text - the text for the label (null not permitted).
font - the font (null not permitted).
paint - the paint (null not permitted).

Method Details

arrange

public Size2D arrange(Graphics2D g2,
                      RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and returns the block size.
Specified by:
arrange in interface Block
Overrides:
arrange in interface AbstractBlock
Parameters:
g2 - the graphics device.
constraint - the constraint (null not permitted).
Returns:
The block size (in Java2D units, never null).

clone

public Object clone()
            throws CloneNotSupportedException
Returns a clone of this LabelBlock instance.
Overrides:
clone in interface AbstractBlock
Returns:
A clone.

draw

public void draw(Graphics2D g2,
                 Rectangle2D area)
Draws the block.
Parameters:
g2 - the graphics device.
area - the area.

draw

public Object draw(Graphics2D g2,
                   Rectangle2D area,
                   Object params)
Draws the block within the specified area.
Specified by:
draw in interface Block
Parameters:
g2 - the graphics device.
area - the area.
params - ignored (null permitted).
Returns:
Always null.

equals

public boolean equals(Object obj)
Tests this LabelBlock for equality with an arbitrary object.
Overrides:
equals in interface AbstractBlock
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

getFont

public Font getFont()
Returns the font.
Returns:
The font (never null).
See Also:
setFont(Font)

getPaint

public Paint getPaint()
Returns the paint.
Returns:
The paint (never null).

getToolTipText

public String getToolTipText()
Returns the tool tip text.
Returns:
The tool tip text (possibly null).

getURLText

public String getURLText()
Returns the URL text.
Returns:
The URL text (possibly null).

setFont

public void setFont(Font font)
Sets the font and regenerates the label.
Parameters:
font - the font (null not permitted).
See Also:
getFont()

setPaint

public void setPaint(Paint paint)
Sets the paint and regenerates the label.
Parameters:
paint - the paint (null not permitted).
See Also:
getPaint()

setToolTipText

public void setToolTipText(String text)
Sets the tool tip text.
Parameters:
text - the text (null permitted).

setURLText

public void setURLText(String text)
Sets the URL text.
Parameters:
text - the text (null permitted).
See Also:
getURLText()