|
RePast v. 2.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--uchicago.src.sim.gui.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 Color |
black
|
static Color |
blue
|
static Color |
cyan
|
static Color |
darkGray
|
static Color |
gray
|
static Color |
green
|
static Color |
lightGray
|
static Color |
magenta
|
static Color |
orange
|
static Color |
pink
|
static Color |
red
|
static Color |
white
|
static Color |
yellow
|
| Constructor Summary | |
ColorMap()
|
|
| Method Summary | |
Color |
getColor(int i)
Gets the color mapped to the specified int |
Color |
getColor(Integer i)
Gets the color mapped to the specified Integer |
void |
mapColor(int i,
Color c)
Maps the specified color to the specified int |
void |
mapColor(int i,
double red,
double green,
double blue)
Maps the color specified by the red, green, and blue values to to the int i. |
void |
mapColor(Integer i,
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 Color white
public static final Color lightGray
public static final Color gray
public static final Color darkGray
public static final Color black
public static final Color red
public static final Color pink
public static final Color orange
public static final Color yellow
public static final Color green
public static final Color magenta
public static final Color cyan
public static final Color blue
| Constructor Detail |
public ColorMap()
| Method Detail |
public void mapColor(Integer i,
Color c)
i - the integer to map the color toc - the color to map to the Integer
public void mapColor(int i,
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)
for (int i = 0; i < 64; i++) {
map.setColor(i, i / 63.0, 0, 0)
}
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]public Color getColor(Integer i)
public Color getColor(int i)
|
RePast v. 2.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||