Module org.jfree.chart3d
Package org.jfree.chart3d.plot

# Class StandardColorSource<K extends Comparable<K>>

java.lang.Object
org.jfree.chart3d.plot.StandardColorSource<K>

All Implemented Interfaces:
  `Serializable`, `ColorSource<K>`

public final class StandardColorSource<K extends Comparable<K>> extends Object implements ColorSource<K>, Serializable
A standard implementation of the `ColorSource` interface.
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`StandardColorSource()`
Creates a new instance with default colors.
`StandardColorSource(Color... colors)`
Creates a new instance with the supplied sequence of colors.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
Tests this paint source for equality with an arbitrary object.
`Color`
`getColor(K key)`
Returns the color associated with the specified key.
`void`
`setColor(K key, Color color)`
Sets the color for the specified key.
`void`
`style(Color... colors)`
Clears existing color settings and sets the default colors to the supplied value.

### Methods inherited from class java.lang.Object

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

## Constructor Details

### StandardColorSource

public StandardColorSource()
Creates a new instance with default colors.

### StandardColorSource

public StandardColorSource(Color... colors)
Creates a new instance with the supplied sequence of colors. The supplied array must have at least one entry, and all entries must be non-`null`.

Parameters:
  `colors` - the colors (`null` not permitted).

## Method Details

### getColor

public Color getColor(K key)
Returns the color associated with the specified key.

Specified by:
  `getColor` in interface `ColorSource<K extends Comparable<K>>`
Parameters:
  `key` - the key (`null` not permitted).
Returns:
  The color (never `null`).

### setColor

public void setColor(K key, Color color)
Sets the color for the specified key.

Specified by:
  `setColor` in interface `ColorSource<K extends Comparable<K>>`
Parameters:
  `key` - the key (`null` not permitted).
  `color` - the color (`null` permitted).

### style

public void style(Color... colors)
Clears existing color settings and sets the default colors to the supplied value. This method is used by the framework and is not normally called by client code.

Specified by:
  `style` in interface `ColorSource<K extends Comparable<K>>`
Parameters:
  `colors` - the colors (`null` not permitted).
Since:
  1.2

### equals

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

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