## org.jfree.chart
Class LegendItem

    java.lang.Object
      org.jfree.chart.LegendItem

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable

    public class LegendItem

extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A temporary storage object for recording the properties of a legend item, without any consideration for layout issues.

See Also:
  Serialized Form

Constructor Summary

`LegendItem(java.text.AttributedString label, java.lang.String description, java.lang.String toolTipText, java.lang.String urlText, boolean shapeVisible, java.awt.Shape shape, boolean shapeFilled, java.awt.Paint fillPaint, boolean shapeOutlineVisible, java.awt.Paint outlinePaint, java.awt.Stroke outlineStroke, boolean lineVisible, java.awt.Shape line, java.awt.Stroke lineStroke, java.awt.Paint linePaint)`
Creates a new legend item.

`LegendItem(java.text.AttributedString label, java.lang.String description, java.lang.String toolTipText, java.lang.String urlText, java.awt.Shape shape, java.awt.Paint fillPaint)` Creates a legend item with a filled shape.
`LegendItem(java.text.AttributedString label, java.lang.String description, java.lang.String toolTipText, java.lang.String urlText, java.awt.Shape shape, java.awt.Paint fillPaint, java.awt.Stroke outlineStroke, java.awt.Paint outlinePaint)` Creates a legend item with a filled and outlined shape.
`LegendItem(java.text.AttributedString label, java.lang.String description, java.lang.String toolTipText, java.lang.String urlText, java.awt.Shape line, java.awt.Stroke lineStroke, java.awt.Paint linePaint)` Creates a legend item using a line.
`LegendItem(java.lang.String label)` Creates a legend item with the specified label.

`LegendItem(java.lang.String label, java.lang.String description, java.lang.String toolTipText, java.lang.String urlText, boolean shapeVisible, java.awt.Shape shape, boolean shapeFilled, java.awt.Paint fillPaint, boolean shapeOutlineVisible, java.awt.Paint outlinePaint, java.awt.Stroke outlineStroke, boolean lineVisible, java.awt.Shape line, java.awt.Stroke lineStroke, java.awt.Paint linePaint)`
Creates a new legend item.

`LegendItem(java.lang.String label, java.lang.String description, java.lang.String toolTipText, java.lang.String urlText, java.awt.Shape shape, java.awt.Paint fillPaint)` Creates a legend item with a filled shape.
`LegendItem(java.lang.String label, java.lang.String description, java.lang.String toolTipText, java.lang.String urlText, java.awt.Shape shape, java.awt.Paint fillPaint, java.awt.Stroke outlineStroke, java.awt.Paint outlinePaint)` Creates a legend item with a filled and outlined shape.
`LegendItem(java.lang.String label, java.lang.String description, java.lang.String toolTipText, java.lang.String urlText, java.awt.Shape line, java.awt.Stroke lineStroke, java.awt.Paint linePaint)` Creates a legend item using a line.

Method Summary
`java.lang.Object` `clone()` Returns an independent copy of this object (except that the clone will still reference the same dataset as the original `LegendItem`).
`boolean` `equals(java.lang.Object obj)` Tests this item for equality with an arbitrary object.
`java.text.AttributedString` `getAttributedLabel()` Returns the attributed label.
`Dataset` `getDataset()` Returns the dataset.
`int` `getDatasetIndex()` Returns the dataset index for this legend item.
`java.lang.String` `getDescription()` Returns the description for the legend item.
`java.awt.Paint` `getFillPaint()` Returns the fill paint.
`org.jfree.ui.GradientPaintTransformer` `getFillPaintTransformer()` Returns the transformer used when the fill paint is an instance of `GradientPaint`.
`java.lang.String` `getLabel()` Returns the label.
`java.awt.Shape` `getLine()` Returns the line.
`java.awt.Paint` `getLinePaint()` Returns the paint used for lines.
`java.awt.Stroke` `getLineStroke()` Returns the line stroke for the series.
`java.awt.Paint` `getOutlinePaint()` Returns the outline paint.
`java.awt.Stroke` `getOutlineStroke()` Returns the outline stroke.
`int` `getSeriesIndex()` Returns the series index for this legend item.
`java.lang.Comparable` `getSeriesKey()` Returns the series key.
`java.awt.Shape` `getShape()` Returns the shape used to label the series represented by this legend item.
`java.lang.String` `getToolTipText()` Returns the tool tip text.
`java.lang.String` `getURLText()` Returns the URL text.
`boolean` `isLineVisible()` Returns a flag that indicates whether or not the line is visible.
`boolean` `isShapeFilled()` Returns a flag that controls whether or not the shape is filled.
`boolean` `isShapeOutlineVisible()` Returns the flag that controls whether or not the shape outline is visible.
`boolean` `isShapeVisible()` Returns a flag that indicates whether or not the shape is visible.
`void` `setDataset(Dataset dataset)` Sets the dataset.
`void` `setDatasetIndex(int index)` Sets the dataset index for this legend item.
`void` `setFillPaintTransformer(org.jfree.ui.GradientPaintTransformer transformer)` Sets the transformer used when the fill paint is an instance of `GradientPaint`.
`void` `setSeriesIndex(int index)` Sets the series index for this legend item.
`void` `setSeriesKey(java.lang.Comparable key)` Sets the series key.

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LegendItem

    public LegendItem(java.lang.String label)

  Creates a legend item with the specified label. The remaining attributes take default values.

  Parameters:
    `label` - the label (`null` not permitted).
  Since:
    1.0.10

### LegendItem

    public LegendItem(java.lang.String label,
                      java.lang.String description,
                      java.lang.String toolTipText,
                      java.lang.String urlText,
                      java.awt.Shape shape,
                      java.awt.Paint fillPaint)

  Creates a legend item with a filled shape. The shape is not outlined, and no line is visible.

  Parameters:
    `label` - the label (`null` not permitted).
    `description` - the description (`null` permitted).
    `toolTipText` - the tool tip text (`null` permitted).
    `urlText` - the URL text (`null` permitted).
    `shape` - the shape (`null` not permitted).
    `fillPaint` - the paint used to fill the shape (`null` not permitted).

### LegendItem

    public LegendItem(java.lang.String label,
                      java.lang.String description,
                      java.lang.String toolTipText,
                      java.lang.String urlText,
                      java.awt.Shape shape,
                      java.awt.Paint fillPaint,
                      java.awt.Stroke outlineStroke,
                      java.awt.Paint outlinePaint)

  Creates a legend item with a filled and outlined shape.

  Parameters:
    `label` - the label (`null` not permitted).
    `description` - the description (`null` permitted).
    `toolTipText` - the tool tip text (`null` permitted).
    `urlText` - the URL text (`null` permitted).
    `shape` - the shape (`null` not permitted).
    `fillPaint` - the paint used to fill the shape (`null` not permitted).
    `outlineStroke` - the outline stroke (`null` not permitted).
    `outlinePaint` - the outline paint (`null` not permitted).

### LegendItem

    public LegendItem(java.lang.String label,
                      java.lang.String description,
                      java.lang.String toolTipText,
                      java.lang.String urlText,
                      java.awt.Shape line,
                      java.awt.Stroke lineStroke,
                      java.awt.Paint linePaint)

  Creates a legend item using a line.

  Parameters:
    `label` - the label (`null` not permitted).
    `description` - the description (`null` permitted).
    `toolTipText` - the tool tip text (`null` permitted).
    `urlText` - the URL text (`null` permitted).
    `line` - the line (`null` not permitted).
    `lineStroke` - the line stroke (`null` not permitted).
    `linePaint` - the line paint (`null` not permitted).

### LegendItem

    public LegendItem(java.lang.String label,
                      java.lang.String description,
                      java.lang.String toolTipText,
                      java.lang.String urlText,
                      boolean shapeVisible,
                      java.awt.Shape shape,
                      boolean shapeFilled,
                      java.awt.Paint fillPaint,
                      boolean shapeOutlineVisible,
                      java.awt.Paint outlinePaint,
                      java.awt.Stroke outlineStroke,
                      boolean lineVisible,
                      java.awt.Shape line,
                      java.awt.Stroke lineStroke,
                      java.awt.Paint linePaint)

  Creates a new legend item.

  Parameters:
    `label` - the label (`null` not permitted).
    `description` - the description (not currently used, `null` permitted).
    `toolTipText` - the tool tip text (`null` permitted).
    `urlText` - the URL text (`null` permitted).
    `shapeVisible` - a flag that controls whether or not the shape is displayed.
    `shape` - the shape (`null` permitted).
    `shapeFilled` - a flag that controls whether or not the shape is filled.
    `fillPaint` - the fill paint (`null` not permitted).
    `shapeOutlineVisible` - a flag that controls whether or not the shape is outlined.
    `outlinePaint` - the outline paint (`null` not permitted).
    `outlineStroke` - the outline stroke (`null` not permitted).
    `lineVisible` - a flag that controls whether or not the line is visible.
    `line` - the line.
    `lineStroke` - the stroke (`null` not permitted).
    `linePaint` - the line paint (`null` not permitted).

### LegendItem

    public LegendItem(java.text.AttributedString label,
                      java.lang.String description,
                      java.lang.String toolTipText,
                      java.lang.String urlText,
                      java.awt.Shape shape,
                      java.awt.Paint fillPaint)

  Creates a legend item with a filled shape. The shape is not outlined, and no line is visible.

  Parameters:
    `label` - the label (`null` not permitted).
    `description` - the description (`null` permitted).
    `toolTipText` - the tool tip text (`null` permitted).
    `urlText` - the URL text (`null` permitted).
    `shape` - the shape (`null` not permitted).
    `fillPaint` - the paint used to fill the shape (`null` not permitted).

### LegendItem

    public LegendItem(java.text.AttributedString label,
                      java.lang.String description,
                      java.lang.String toolTipText,
                      java.lang.String urlText,
                      java.awt.Shape shape,
                      java.awt.Paint fillPaint,
                      java.awt.Stroke outlineStroke,
                      java.awt.Paint outlinePaint)

  Creates a legend item with a filled and outlined shape.

  Parameters:
    `label` - the label (`null` not permitted).
    `description` - the description (`null` permitted).
    `toolTipText` - the tool tip text (`null` permitted).
    `urlText` - the URL text (`null` permitted).
    `shape` - the shape (`null` not permitted).
    `fillPaint` - the paint used to fill the shape (`null` not permitted).
    `outlineStroke` - the outline stroke (`null` not permitted).
    `outlinePaint` - the outline paint (`null` not permitted).

### LegendItem

    public LegendItem(java.text.AttributedString label,
                      java.lang.String description,
                      java.lang.String toolTipText,
                      java.lang.String urlText,
                      java.awt.Shape line,
                      java.awt.Stroke lineStroke,
                      java.awt.Paint linePaint)

  Creates a legend item using a line.

  Parameters:
    `label` - the label (`null` not permitted).
    `description` - the description (`null` permitted).
    `toolTipText` - the tool tip text (`null` permitted).
    `urlText` - the URL text (`null` permitted).
    `line` - the line (`null` not permitted).
    `lineStroke` - the line stroke (`null` not permitted).
    `linePaint` - the line paint (`null` not permitted).

### LegendItem

    public LegendItem(java.text.AttributedString label,
                      java.lang.String description,
                      java.lang.String toolTipText,
                      java.lang.String urlText,
                      boolean shapeVisible,
                      java.awt.Shape shape,
                      boolean shapeFilled,
                      java.awt.Paint fillPaint,
                      boolean shapeOutlineVisible,
                      java.awt.Paint outlinePaint,
                      java.awt.Stroke outlineStroke,
                      boolean lineVisible,
                      java.awt.Shape line,
                      java.awt.Stroke lineStroke,
                      java.awt.Paint linePaint)

  Creates a new legend item.

  Parameters:
    `label` - the label (`null` not permitted).
    `description` - the description (not currently used, `null` permitted).
    `toolTipText` - the tool tip text (`null` permitted).
    `urlText` - the URL text (`null` permitted).
    `shapeVisible` - a flag that controls whether or not the shape is displayed.
    `shape` - the shape (`null` permitted).
    `shapeFilled` - a flag that controls whether or not the shape is filled.
    `fillPaint` - the fill paint (`null` not permitted).
    `shapeOutlineVisible` - a flag that controls whether or not the shape is outlined.
    `outlinePaint` - the outline paint (`null` not permitted).
    `outlineStroke` - the outline stroke (`null` not permitted).
    `lineVisible` - a flag that controls whether or not the line is visible.
    `line` - the line (`null` not permitted).
    `lineStroke` - the stroke (`null` not permitted).
    `linePaint` - the line paint (`null` not permitted).

Method Detail

### getDataset

    public Dataset getDataset()

  Returns the dataset.

  Returns:
    The dataset.
  Since:
    1.0.6
  See Also:
    `setDatasetIndex(int)`

### setDataset

    public void setDataset(Dataset dataset)

  Sets the dataset.

  Parameters:
    `dataset` - the dataset.
  Since:
    1.0.6

### getDatasetIndex

    public int getDatasetIndex()

  Returns the dataset index for this legend item.

  Returns:
    The dataset index.
  Since:
    1.0.2
  See Also:
    `setDatasetIndex(int)`, `getDataset()`

### setDatasetIndex

    public void setDatasetIndex(int index)

  Sets the dataset index for this legend item.

  Parameters:
    `index` - the index.
  Since:
    1.0.2
  See Also:
    `getDatasetIndex()`

### getSeriesKey

    public java.lang.Comparable getSeriesKey()

  Returns the series key.

  Returns:
    The series key.
  Since:
    1.0.6
  See Also:
    `setSeriesKey(Comparable)`

### setSeriesKey

    public void setSeriesKey(java.lang.Comparable key)

  Sets the series key.

  Parameters:
    `key` - the series key.
  Since:
    1.0.6

### getSeriesIndex

    public int getSeriesIndex()

  Returns the series index for this legend item.

  Returns:
    The series index.
  Since:
    1.0.2

### setSeriesIndex

    public void setSeriesIndex(int index)

  Sets the series index for this legend item.

  Parameters:
    `index` - the index.
  Since:
    1.0.2

### getLabel

    public java.lang.String getLabel()

  Returns the label.

  Returns:
    The label (never `null`).

### getAttributedLabel

    public java.text.AttributedString getAttributedLabel()

  Returns the attributed label.

  Returns:
    The attributed label (possibly `null`).

### getDescription

    public java.lang.String getDescription()

  Returns the description for the legend item.

  Returns:
    The description.

### getToolTipText

    public java.lang.String getToolTipText()

  Returns the tool tip text.

  Returns:
    The tool tip text (possibly `null`).

### getURLText

    public java.lang.String getURLText()

  Returns the URL text.

  Returns:
    The URL text (possibly `null`).

### isShapeVisible

    public boolean isShapeVisible()

  Returns a flag that indicates whether or not the shape is visible.

  Returns:
    A boolean.

### getShape

    public java.awt.Shape getShape()

  Returns the shape used to label the series represented by this legend item.

  Returns:
    The shape (never `null`).

### isShapeFilled

    public boolean isShapeFilled()

  Returns a flag that controls whether or not the shape is filled.

  Returns:
    A boolean.

### getFillPaint

    public java.awt.Paint getFillPaint()

  Returns the fill paint.

  Returns:
    The fill paint (never `null`).

### isShapeOutlineVisible

    public boolean isShapeOutlineVisible()

  Returns the flag that controls whether or not the shape outline is visible.

  Returns:
    A boolean.

### getLineStroke

    public java.awt.Stroke getLineStroke()

  Returns the line stroke for the series.

  Returns:
    The stroke (never `null`).

### getLinePaint

    public java.awt.Paint getLinePaint()

  Returns the paint used for lines.

  Returns:
    The paint.

### getOutlinePaint

    public java.awt.Paint getOutlinePaint()

  Returns the outline paint.

  Returns:
    The outline paint (never `null`).

### getOutlineStroke

    public java.awt.Stroke getOutlineStroke()

  Returns the outline stroke.

  Returns:
    The outline stroke (never `null`).

### isLineVisible

    public boolean isLineVisible()

  Returns a flag that indicates whether or not the line is visible.

  Returns:
    A boolean.

### getLine

    public java.awt.Shape getLine()

  Returns the line.

  Returns:
    The line (never `null`).

### getFillPaintTransformer

    public org.jfree.ui.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(GradientPaintTransformer)`

### setFillPaintTransformer

    public void setFillPaintTransformer(org.jfree.ui.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()`

### equals

    public boolean equals(java.lang.Object obj)

  Tests this item for equality with an arbitrary object.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the object (`null` permitted).
  Returns:
    A boolean.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Returns an independent copy of this object (except that the clone will still reference the same dataset as the original `LegendItem`).

  Overrides:
    `clone` in class `java.lang.Object`
  Returns:
    A clone.
  Throws:
    `java.lang.CloneNotSupportedException`
  Since:
    1.0.10