Drawer objects to
paint values on the screen.
Title: JAS
Description: Java Agent-based Simulation library
Copyright (C) 2002 Michele Sonnessa
This library is free software; you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this
library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307, USA.
- Author:
- Michele Sonnessa
Method Summary |
void |
addColor(int value,
java.awt.Color color)
Add a color to the map. |
void |
addColor(int value,
int red,
int green,
int blue)
Add a color to the map using the color components. |
java.awt.Color |
getColor(int index)
Return the color stored at given index. |
int[] |
getColorComponents(int index)
Return the components of the color stored at given index. |
int |
getColorIndex(double value)
Return the index of the color mapped to the given value. |
int |
getColorIndex(int value)
Return the index of the color mapped to the given value. |
addColor
void addColor(int value,
java.awt.Color color)
- Add a color to the map.
- Parameters:
value
- The key value for the color.color
- A java Color to be mapped.
addColor
void addColor(int value,
int red,
int green,
int blue)
- Add a color to the map using the color components.
- Parameters:
value
- The key value for the color.red
- The red component of the color. It must be within the [0-255] range.green
- The green component of the color. It must be within the [0-255] range.blue
- The blue component of the color. It must be within the [0-255] range.
getColor
java.awt.Color getColor(int index)
- Return the color stored at given index.
- Parameters:
index
- The index of the color. It is a 0-based index of the color
corresponding to the adding order.
- Returns:
- The mapped color.
getColorComponents
int[] getColorComponents(int index)
- Return the components of the color stored at given index.
- Parameters:
index
- The index of the color. It is a 0-based index of the color
corresponding to the adding order.
- Returns:
- An array of 3 integers representing the RGB components of the color.
getColorIndex
int getColorIndex(double value)
- Return the index of the color mapped to the given value.
- Parameters:
value
- The value mapped to the color.
- Returns:
- The array index of the requested color.
getColorIndex
int getColorIndex(int value)
- Return the index of the color mapped to the given value.
- Parameters:
value
- The value mapped to the color.
- Returns:
- The array index of the requested color.