# Class LegendIcon

java.lang.Object
uk.ac.starlink.ttools.plot2.LegendIcon

All Implemented Interfaces:
  `Icon`

@Equality public class LegendIcon extends Object implements Icon
Icon containing legend information for a plot.

Since:
  13 Feb 2013
Author:
  Mark Taylor

## Constructor Summary

Constructors
Constructor
Description
`LegendIcon(LegendEntry[] entries, Captioner captioner, boolean border, Color bgColor)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object o)`
`Color`
`getBackground()`
Returns the background colour of this legend.
`Captioner`
`getCaptioner()`
Returns this legend's captioner.
`int`
`getIconHeight()`
`int`
`getIconWidth()`
`boolean`
`hasBorder()`
Indicates whether this legend has a border.
`int`
`hashCode()`
`void`
`paintIcon(Component c, Graphics g, int x0, int y0)`

### Methods inherited from class Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LegendIcon

public LegendIcon(LegendEntry[] entries, Captioner captioner, boolean border, Color bgColor)
Constructor.

Parameters:
  `entries` - items to display in legend
  `captioner` - text renderer
  `border` - true to draw a line border around the legend
  `bgColor` - opaque background colour, null for transparent

## Method Details

### getCaptioner

public Captioner getCaptioner()
Returns this legend's captioner.

Returns:
  captioner

### hasBorder

public boolean hasBorder()
Indicates whether this legend has a border.

Returns:
  true for border, false for not

### getBackground

public Color getBackground()
Returns the background colour of this legend.

Returns:
  background colour

### getIconWidth

public int getIconWidth()

Specified by:
  `getIconWidth` in interface `Icon`

### getIconHeight

public int getIconHeight()

Specified by:
  `getIconHeight` in interface `Icon`

### paintIcon

public void paintIcon(Component c, Graphics g, int x0, int y0)

Specified by:
  `paintIcon` in interface `Icon`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`