Package org.jfree.chart.title
Class LegendGraphic
java.lang.Object
org.jfree.chart.block.AbstractBlock
org.jfree.chart.title.LegendGraphic
- All Implemented Interfaces:
Serializable
,Cloneable
,Block
,Drawable
,PublicCloneable
The graphical item within a legend item.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionarrange
(Graphics2D g2, RectangleConstraint constraint) Arranges the contents of the block, within the given constraints, and returns the block size.protected Size2D
arrangeNN
(Graphics2D g2) Performs the layout with no constraint, so the content size is determined by the bounds of the shape and/or line drawn to represent the series.boolean
Ensures symmetry between super/subclass implementations of equals.clone()
Returns a clone of thisLegendGraphic
instance.void
draw
(Graphics2D g2, Rectangle2D area) Draws the graphic item within the specified area.draw
(Graphics2D g2, Rectangle2D area, Object params) Draws the block within the specified area.boolean
Tests thisLegendGraphic
instance for equality with an arbitrary object.Returns the paint used to fill the shape.Returns the transformer used when the fill paint is an instance ofGradientPaint
.getLine()
Returns the line centered about (0, 0).Returns the line paint.Returns the line stroke.Returns the outline paint.Returns the outline stroke.getShape()
Returns the shape.Returns the shape anchor.Returns the shape location.int
hashCode()
Returns a hash code for this instance.boolean
Returns the flag that controls whether or not the line is visible.boolean
Returns a flag that controls whether or not the shapes are filled.boolean
Returns a flag that controls whether the shape outline is visible.boolean
Returns a flag that controls whether or not the shape is visible.void
setFillPaint
(Paint paint) Sets the paint used to fill the shape.void
setFillPaintTransformer
(GradientPaintTransformer transformer) Sets the transformer used when the fill paint is an instance ofGradientPaint
.void
Sets the line.void
setLinePaint
(Paint paint) Sets the line paint.void
setLineStroke
(Stroke stroke) Sets the line stroke.void
setLineVisible
(boolean visible) Sets the flag that controls whether or not the line is visible.void
setOutlinePaint
(Paint paint) Sets the outline paint.void
setOutlineStroke
(Stroke stroke) Sets the outline stroke.void
Sets the shape.void
setShapeAnchor
(RectangleAnchor anchor) Sets the shape anchor.void
setShapeFilled
(boolean filled) Sets a flag that controls whether or not the shape is filled.void
setShapeLocation
(RectangleAnchor location) Sets the shape location.void
setShapeOutlineVisible
(boolean visible) Sets a flag that controls whether or not the shape outline is visible.void
setShapeVisible
(boolean visible) Sets a flag that controls whether or not the shape is visible.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
-
Constructor Details
-
LegendGraphic
Creates a new legend graphic.- Parameters:
shape
- the shape (null
not permitted).fillPaint
- the fill paint (null
not permitted).
-
-
Method Details
-
isShapeVisible
Returns a flag that controls whether or not the shape is visible.- Returns:
- A boolean.
- See Also:
-
setShapeVisible
Sets a flag that controls whether or not the shape is visible.- Parameters:
visible
- the flag.- See Also:
-
getShape
Returns the shape.- Returns:
- The shape.
- See Also:
-
setShape
Sets the shape.- Parameters:
shape
- the shape.- See Also:
-
isShapeFilled
Returns a flag that controls whether or not the shapes are filled.- Returns:
- A boolean.
- See Also:
-
setShapeFilled
Sets a flag that controls whether or not the shape is filled.- Parameters:
filled
- the flag.- See Also:
-
getFillPaint
Returns the paint used to fill the shape.- Returns:
- The fill paint.
- See Also:
-
setFillPaint
Sets the paint used to fill the shape.- Parameters:
paint
- the paint.- See Also:
-
getFillPaintTransformer
Returns the transformer used when the fill paint is an instance ofGradientPaint
.- Returns:
- The transformer (never
null
). - See Also:
-
setFillPaintTransformer
Sets the transformer used when the fill paint is an instance ofGradientPaint
.- Parameters:
transformer
- the transformer (null
not permitted).- See Also:
-
isShapeOutlineVisible
Returns a flag that controls whether the shape outline is visible.- Returns:
- A boolean.
- See Also:
-
setShapeOutlineVisible
Sets a flag that controls whether or not the shape outline is visible.- Parameters:
visible
- the flag.- See Also:
-
getOutlinePaint
Returns the outline paint.- Returns:
- The paint.
- See Also:
-
setOutlinePaint
Sets the outline paint.- Parameters:
paint
- the paint.- See Also:
-
getOutlineStroke
Returns the outline stroke.- Returns:
- The stroke.
- See Also:
-
setOutlineStroke
Sets the outline stroke.- Parameters:
stroke
- the stroke.- See Also:
-
getShapeAnchor
Returns the shape anchor.- Returns:
- The shape anchor.
- See Also:
-
setShapeAnchor
Sets the shape anchor. This defines a point on the shapes bounding rectangle that will be used to align the shape to a location.- Parameters:
anchor
- the anchor (null
not permitted).- See Also:
-
getShapeLocation
Returns the shape location.- Returns:
- The shape location.
- See Also:
-
setShapeLocation
Sets the shape location. This defines a point within the drawing area that will be used to align the shape to.- Parameters:
location
- the location (null
not permitted).- See Also:
-
isLineVisible
Returns the flag that controls whether or not the line is visible.- Returns:
- A boolean.
- See Also:
-
setLineVisible
Sets the flag that controls whether or not the line is visible.- Parameters:
visible
- the flag.- See Also:
-
getLine
Returns the line centered about (0, 0).- Returns:
- The line.
- See Also:
-
setLine
Sets the line. A Shape is used here, because then you can use Line2D, GeneralPath or any other Shape to represent the line.- Parameters:
line
- the line.- See Also:
-
getLinePaint
Returns the line paint.- Returns:
- The paint.
- See Also:
-
setLinePaint
Sets the line paint.- Parameters:
paint
- the paint.- See Also:
-
getLineStroke
Returns the line stroke.- Returns:
- The stroke.
- See Also:
-
setLineStroke
Sets the line stroke.- Parameters:
stroke
- the stroke.- See Also:
-
arrange
Arranges the contents of the block, within the given constraints, and returns the block size.- Specified by:
arrange
in interfaceBlock
- Overrides:
arrange
in classAbstractBlock
- Parameters:
g2
- the graphics device.constraint
- the constraint (null
not permitted).- Returns:
- The block size (in Java2D units, never
null
).
-
arrangeNN
Performs the layout with no constraint, so the content size is determined by the bounds of the shape and/or line drawn to represent the series.- Parameters:
g2
- the graphics device.- Returns:
- The content size.
-
draw
Draws the graphic item within the specified area. -
draw
Draws the block within the specified area. -
equals
Tests thisLegendGraphic
instance for equality with an arbitrary object.- Overrides:
equals
in classAbstractBlock
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
canEqual
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Overrides:
canEqual
in classAbstractBlock
- Parameters:
other
- Object- Returns:
- true ONLY if the parameter is THIS class type
-
hashCode
Returns a hash code for this instance.- Overrides:
hashCode
in classAbstractBlock
- Returns:
- A hash code.
-
clone
Returns a clone of thisLegendGraphic
instance.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classAbstractBlock
- Returns:
- A clone of this
LegendGraphic
instance. - Throws:
CloneNotSupportedException
- if there is a problem cloning.
-