org.jfree.chart.title

Class LegendGraphic

public class LegendGraphic extends AbstractBlock implements Block, PublicCloneable

The graphical item within a legend item.
Constructor Summary
LegendGraphic(Shape shape, Paint fillPaint)
Creates a new legend graphic.
Method Summary
Size2Darrange(Graphics2D g2, RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and returns the block size.
protected Size2DarrangeNN(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.
Objectclone()
Returns a clone of this LegendGraphic instance.
voiddraw(Graphics2D g2, Rectangle2D area)
Draws the graphic item within the specified area.
Objectdraw(Graphics2D g2, Rectangle2D area, Object params)
Draws the block within the specified area.
booleanequals(Object obj)
Tests this LegendGraphic instance for equality with an arbitrary object.
PaintgetFillPaint()
Returns the paint used to fill the shape.
GradientPaintTransformergetFillPaintTransformer()
Returns the transformer used when the fill paint is an instance of GradientPaint.
ShapegetLine()
Returns the line centered about (0, 0).
PaintgetLinePaint()
Returns the line paint.
StrokegetLineStroke()
Returns the line stroke.
PaintgetOutlinePaint()
Returns the outline paint.
StrokegetOutlineStroke()
Returns the outline stroke.
ShapegetShape()
Returns the shape.
RectangleAnchorgetShapeAnchor()
Returns the shape anchor.
RectangleAnchorgetShapeLocation()
Returns the shape location.
inthashCode()
Returns a hash code for this instance.
booleanisLineVisible()
Returns the flag that controls whether or not the line is visible.
booleanisShapeFilled()
Returns a flag that controls whether or not the shapes are filled.
booleanisShapeOutlineVisible()
Returns a flag that controls whether the shape outline is visible.
booleanisShapeVisible()
Returns a flag that controls whether or not the shape is visible.
voidsetFillPaint(Paint paint)
Sets the paint used to fill the shape.
voidsetFillPaintTransformer(GradientPaintTransformer transformer)
Sets the transformer used when the fill paint is an instance of GradientPaint.
voidsetLine(Shape line)
Sets the line.
voidsetLinePaint(Paint paint)
Sets the line paint.
voidsetLineStroke(Stroke stroke)
Sets the line stroke.
voidsetLineVisible(boolean visible)
Sets the flag that controls whether or not the line is visible.
voidsetOutlinePaint(Paint paint)
Sets the outline paint.
voidsetOutlineStroke(Stroke stroke)
Sets the outline stroke.
voidsetShape(Shape shape)
Sets the shape.
voidsetShapeAnchor(RectangleAnchor anchor)
Sets the shape anchor.
voidsetShapeFilled(boolean filled)
Sets a flag that controls whether or not the shape is filled.
voidsetShapeLocation(RectangleAnchor location)
Sets the shape location.
voidsetShapeOutlineVisible(boolean visible)
Sets a flag that controls whether or not the shape outline is visible.
voidsetShapeVisible(boolean visible)
Sets a flag that controls whether or not the shape is visible.

Constructor Detail

LegendGraphic

public LegendGraphic(Shape shape, Paint fillPaint)
Creates a new legend graphic.

Parameters: shape the shape (null not permitted). fillPaint the fill paint (null not permitted).

Method Detail

arrange

public Size2D arrange(Graphics2D g2, RectangleConstraint constraint)
Arranges the contents of the block, within the given constraints, and returns the block size.

Parameters: g2 the graphics device. constraint the constraint (null not permitted).

Returns: The block size (in Java2D units, never null).

arrangeNN

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.

Parameters: g2 the graphics device.

Returns: The content size.

clone

public Object clone()
Returns a clone of this LegendGraphic instance.

Returns: A clone of this LegendGraphic instance.

Throws: CloneNotSupportedException if there is a problem cloning.

draw

public void draw(Graphics2D g2, Rectangle2D area)
Draws the graphic item within the specified area.

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.

Parameters: g2 the graphics device. area the area. params ignored (null permitted).

Returns: Always null.

equals

public boolean equals(Object obj)
Tests this LegendGraphic instance for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: A boolean.

getFillPaint

public Paint getFillPaint()
Returns the paint used to fill the shape.

Returns: The fill paint.

See Also: setFillPaint

getFillPaintTransformer

public GradientPaintTransformer getFillPaintTransformer()
Returns the transformer used when the fill paint is an instance of GradientPaint.

Returns: The transformer (never null).

Since: 1.0.4.

See Also: setFillPaintTransformer

getLine

public Shape getLine()
Returns the line centered about (0, 0).

Returns: The line.

See Also: setLine

getLinePaint

public Paint getLinePaint()
Returns the line paint.

Returns: The paint.

See Also: setLinePaint

getLineStroke

public Stroke getLineStroke()
Returns the line stroke.

Returns: The stroke.

See Also: setLineStroke

getOutlinePaint

public Paint getOutlinePaint()
Returns the outline paint.

Returns: The paint.

See Also: setOutlinePaint

getOutlineStroke

public Stroke getOutlineStroke()
Returns the outline stroke.

Returns: The stroke.

See Also: setOutlineStroke

getShape

public Shape getShape()
Returns the shape.

Returns: The shape.

See Also: setShape

getShapeAnchor

public RectangleAnchor getShapeAnchor()
Returns the shape anchor.

Returns: The shape anchor.

See Also: getShapeAnchor

getShapeLocation

public RectangleAnchor getShapeLocation()
Returns the shape location.

Returns: The shape location.

See Also: setShapeLocation

hashCode

public int hashCode()
Returns a hash code for this instance.

Returns: A hash code.

isLineVisible

public boolean isLineVisible()
Returns the flag that controls whether or not the line is visible.

Returns: A boolean.

See Also: LegendGraphic

isShapeFilled

public boolean isShapeFilled()
Returns a flag that controls whether or not the shapes are filled.

Returns: A boolean.

See Also: LegendGraphic

isShapeOutlineVisible

public boolean isShapeOutlineVisible()
Returns a flag that controls whether the shape outline is visible.

Returns: A boolean.

See Also: LegendGraphic

isShapeVisible

public boolean isShapeVisible()
Returns a flag that controls whether or not the shape is visible.

Returns: A boolean.

See Also: LegendGraphic

setFillPaint

public void setFillPaint(Paint paint)
Sets the paint used to fill the shape.

Parameters: paint the paint.

See Also: getFillPaint

setFillPaintTransformer

public void setFillPaintTransformer(GradientPaintTransformer transformer)
Sets the transformer used when the fill paint is an instance of GradientPaint.

Parameters: transformer the transformer (null not permitted).

Since: 1.0.4

See Also: getFillPaintTransformer

setLine

public void setLine(Shape line)
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: getLine

setLinePaint

public void setLinePaint(Paint paint)
Sets the line paint.

Parameters: paint the paint.

See Also: getLinePaint

setLineStroke

public void setLineStroke(Stroke stroke)
Sets the line stroke.

Parameters: stroke the stroke.

See Also: getLineStroke

setLineVisible

public void setLineVisible(boolean visible)
Sets the flag that controls whether or not the line is visible.

Parameters: visible the flag.

See Also: isLineVisible

setOutlinePaint

public void setOutlinePaint(Paint paint)
Sets the outline paint.

Parameters: paint the paint.

See Also: getOutlinePaint

setOutlineStroke

public void setOutlineStroke(Stroke stroke)
Sets the outline stroke.

Parameters: stroke the stroke.

See Also: getOutlineStroke

setShape

public void setShape(Shape shape)
Sets the shape.

Parameters: shape the shape.

See Also: getShape

setShapeAnchor

public void setShapeAnchor(RectangleAnchor anchor)
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: setShapeAnchor

setShapeFilled

public void setShapeFilled(boolean filled)
Sets a flag that controls whether or not the shape is filled.

Parameters: filled the flag.

See Also: isShapeFilled

setShapeLocation

public void setShapeLocation(RectangleAnchor location)
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: getShapeLocation

setShapeOutlineVisible

public void setShapeOutlineVisible(boolean visible)
Sets a flag that controls whether or not the shape outline is visible.

Parameters: visible the flag.

See Also: isShapeOutlineVisible

setShapeVisible

public void setShapeVisible(boolean visible)
Sets a flag that controls whether or not the shape is visible.

Parameters: visible the flag.

See Also: isShapeVisible

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.