Package org.jfree.chart.block
Class LabelBlock
java.lang.Object
org.jfree.chart.block.AbstractBlock
org.jfree.chart.block.LabelBlock
- All Implemented Interfaces:
Serializable,Cloneable,Block,Drawable,PublicCloneable
A block containing a label.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLabelBlock(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
Modifier and TypeMethodDescriptionarrange(Graphics2D g2, RectangleConstraint constraint) Arranges the contents of the block, within the given constraints, and returns the block size.booleanEnsures symmetry between super/subclass implementations of equals.clone()Returns a clone of thisLabelBlockinstance.voiddraw(Graphics2D g2, Rectangle2D area) Draws the block.draw(Graphics2D g2, Rectangle2D area, Object params) Draws the block within the specified area.booleanTests thisLabelBlockfor equality with an arbitrary object.Returns the content alignment point.getFont()Returns the font.getPaint()Returns the paint.Returns the text anchor (nevernull).Returns the tool tip text.Returns the URL text.inthashCode()voidSets the content alignment point.voidSets the font and regenerates the label.voidSets the paint and regenerates the label.voidsetTextAnchor(RectangleAnchor anchor) Sets the text anchor.voidsetToolTipText(String text) Sets the tool tip text.voidsetURLText(String text) Sets the URL text.Methods inherited from class org.jfree.chart.block.AbstractBlock
arrange, calculateTotalHeight, calculateTotalWidth, drawBorder, getBounds, getContentXOffset, getContentYOffset, getFrame, getHeight, getID, getMargin, getPadding, getWidth, setBorder, setBounds, setFrame, setHeight, setID, setMargin, setMargin, setPadding, setPadding, setWidth, toContentConstraint, trimBorder, trimMargin, trimPadding, trimToContentHeight, trimToContentWidth
-
Field Details
-
DEFAULT_PAINT
The default color.
-
-
Constructor Details
-
LabelBlock
Creates a new label block.- Parameters:
label- the label (nullnot permitted).
-
LabelBlock
Creates a new label block.- Parameters:
text- the text for the label (nullnot permitted).font- the font (nullnot permitted).
-
LabelBlock
Creates a new label block.- Parameters:
text- the text for the label (nullnot permitted).font- the font (nullnot permitted).paint- the paint (nullnot permitted).
-
-
Method Details
-
getFont
Returns the font.- Returns:
- The font (never
null). - See Also:
-
setFont
Sets the font and regenerates the label.- Parameters:
font- the font (nullnot permitted).- See Also:
-
getPaint
Returns the paint.- Returns:
- The paint (never
null). - See Also:
-
setPaint
Sets the paint and regenerates the label.- Parameters:
paint- the paint (nullnot permitted).- See Also:
-
getToolTipText
Returns the tool tip text.- Returns:
- The tool tip text (possibly
null). - See Also:
-
setToolTipText
Sets the tool tip text.- Parameters:
text- the text (nullpermitted).- See Also:
-
getURLText
Returns the URL text.- Returns:
- The URL text (possibly
null). - See Also:
-
setURLText
Sets the URL text.- Parameters:
text- the text (nullpermitted).- See Also:
-
getContentAlignmentPoint
Returns the content alignment point.- Returns:
- The content alignment point (never
null).
-
setContentAlignmentPoint
Sets the content alignment point.- Parameters:
anchor- the anchor used to determine the alignment point (nevernull).
-
getTextAnchor
Returns the text anchor (nevernull).- Returns:
- The text anchor.
-
setTextAnchor
Sets the text anchor.- Parameters:
anchor- the anchor (nullnot permitted).
-
arrange
Arranges the contents of the block, within the given constraints, and returns the block size.- Specified by:
arrangein interfaceBlock- Overrides:
arrangein classAbstractBlock- Parameters:
g2- the graphics device.constraint- the constraint (nullnot permitted).- Returns:
- The block size (in Java2D units, never
null).
-
draw
Draws the block. -
draw
Draws the block within the specified area. -
equals
Tests thisLabelBlockfor equality with an arbitrary object.- Overrides:
equalsin classAbstractBlock- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
canEqual
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Overrides:
canEqualin classAbstractBlock- Parameters:
other- Object- Returns:
- true ONLY if the parameter is THIS class type
-
hashCode
- Overrides:
hashCodein classAbstractBlock
-
clone
Returns a clone of thisLabelBlockinstance.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractBlock- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if there is a problem cloning.
-