|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.gui.ColorMap
public class ColorMap
A customizable map of java.awt.Color(s) to Integers. Useful for displaying collections of Integers, such as an Object2DGrid, as colors.
Note that using the method that take int arguments is faster than those that take the Integer arguments.
| Field Summary | |
|---|---|
static java.awt.Color |
black
|
static java.awt.Color |
blue
|
static java.awt.Color |
cyan
|
static java.awt.Color |
darkGray
|
static java.awt.Color |
gray
|
static java.awt.Color |
green
|
static java.awt.Color |
lightGray
|
static java.awt.Color |
magenta
|
static java.awt.Color |
orange
|
static java.awt.Color |
pink
|
static java.awt.Color |
red
|
static java.awt.Color |
white
|
static java.awt.Color |
yellow
|
| Constructor Summary | |
|---|---|
ColorMap()
|
|
| Method Summary | |
|---|---|
java.awt.Color |
getColor(int i)
Gets the color mapped to the specified int |
java.awt.Color |
getColor(java.lang.Integer i)
Gets the color mapped to the specified Integer |
void |
mapColor(int i,
java.awt.Color c)
Maps the specified color to the specified int |
void |
mapColor(int i,
double red,
double green,
double blue)
This is the same as mapColor(int, double, double, double, double) with an
alpha of 1.0 |
void |
mapColor(int i,
double red,
double green,
double blue,
double alpha)
Maps the color specified by the red, green, blue, and alpha values to to the int i. |
void |
mapColor(java.lang.Integer i,
java.awt.Color c)
Maps the specified color to the specified Integer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.awt.Color white
public static final java.awt.Color lightGray
public static final java.awt.Color gray
public static final java.awt.Color darkGray
public static final java.awt.Color black
public static final java.awt.Color red
public static final java.awt.Color pink
public static final java.awt.Color orange
public static final java.awt.Color yellow
public static final java.awt.Color green
public static final java.awt.Color magenta
public static final java.awt.Color cyan
public static final java.awt.Color blue
| Constructor Detail |
|---|
public ColorMap()
| Method Detail |
|---|
public void mapColor(java.lang.Integer i,
java.awt.Color c)
i - the integer to map the color toc - the color to map to the Integer
public void mapColor(int i,
java.awt.Color c)
i - the int to map the color toc - the color to map to the int
public void mapColor(int i,
double red,
double green,
double blue,
double alpha)
for (int i = 0; i < 64; i++) {
map.setColor(i, i / 63.0, 0, 0, 1)
}
This will set 64 shades of red.
i - the int to map the color tored - a double in the range of [0, 1]blue - a double in the range of [0, 1]green - a double in the range of [0, 1]alpha - a double in the range of [0, 1] (as you approach 0 you get
more transparent)
public void mapColor(int i,
double red,
double green,
double blue)
mapColor(int, double, double, double, double) with an
alpha of 1.0
i - the int to map the color tored - a double in the range of [0, 1]blue - a double in the range of [0, 1]green - a double in the range of [0, 1]mapColor(int, double, double, double, double)public java.awt.Color getColor(java.lang.Integer i)
public java.awt.Color getColor(int i)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||