Package org.openjump.core.ui.color
Class ColorGenerator
- java.lang.Object
-
- org.openjump.core.ui.color.ColorGenerator
-
public class ColorGenerator extends Object
Class to generate a given number of color steps to cross fade from color A to color C (and optionally pass color B)- Version:
- $Revision: 1.19 $
- Author:
- Ole Rahn, Stefan Ostermann
FH Osnabrück - University of Applied Sciences Osnabrück,
Project: PIROL (2005),
Subproject: Daten- und Wissensmanagement
-
-
Field Summary
Fields Modifier and Type Field Description protected Color[]colorArrayprotected ListinputColorsprotected intsteps
-
Constructor Summary
Constructors Constructor Description ColorGenerator()For java2xml which needs an empty constructor.ColorGenerator(int steps, Color[] colors)this constructor is untested, yet (but there is no predictable reason, why it should not work...)ColorGenerator(int steps, Color A, Color C)ColorGenerator(int steps, Color A, Color B, Color C)ColorGenerator(int steps, List colors)this constructor is untested, yet (but there is no predictable reason, why it should not work...)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddXMLInputColor(Color color)For java2xmlprotected voidfillColorArray()method to actually generate the colorsstatic ColorGeneratorgetBlueToRedColors(int steps)ColorgetColor(int nr)Returns the nr-th color, generated by this classColor[]getColorArray()static ColorGeneratorgetGreenToRedColors(int steps)Color[]getInputColorsAsArray()static ColorGeneratorgetRedToGreenColors(int steps)static ColorGeneratorgetReverseTrafficLightColors(int steps)intgetSteps()intgetStepsXML()For java2xmlstatic ColorGeneratorgetTrafficLightColors(int steps)CollectiongetXMLInputColors()For java2xmlprotected voidsetColor(int nr, Color color)Sets the nr-th color, originally generated by this classvoidsetSteps(int steps)voidsetStepsXML(int steps)For java2xmlStringtoString()
-
-
-
Constructor Detail
-
ColorGenerator
public ColorGenerator()
For java2xml which needs an empty constructor.
-
ColorGenerator
public ColorGenerator(int steps, List colors)this constructor is untested, yet (but there is no predictable reason, why it should not work...)- Parameters:
steps- number of colors wantedcolors- List containing java.awt.Color objects
-
ColorGenerator
public ColorGenerator(int steps, Color[] colors)this constructor is untested, yet (but there is no predictable reason, why it should not work...)- Parameters:
steps- number of colors wantedcolors- array containing java.awt.Color objects
-
-
Method Detail
-
getTrafficLightColors
public static ColorGenerator getTrafficLightColors(int steps)
-
getGreenToRedColors
public static ColorGenerator getGreenToRedColors(int steps)
-
getRedToGreenColors
public static ColorGenerator getRedToGreenColors(int steps)
-
getReverseTrafficLightColors
public static ColorGenerator getReverseTrafficLightColors(int steps)
-
getBlueToRedColors
public static ColorGenerator getBlueToRedColors(int steps)
-
getColorArray
public Color[] getColorArray()
- Returns:
- All generated colors in an object-array
-
getSteps
public int getSteps()
- Returns:
- the given number of color steps
-
setSteps
public void setSteps(int steps)
- Parameters:
steps- the number of color steps
-
getColor
public Color getColor(int nr)
Returns the nr-th color, generated by this class- Parameters:
nr- zero-based index of the color wanted- Returns:
- Color or null if the given index is out-of-bounds
-
setColor
protected void setColor(int nr, Color color)Sets the nr-th color, originally generated by this class- Parameters:
nr- zero-based index of the color wanted
-
fillColorArray
protected void fillColorArray()
method to actually generate the colors
-
getInputColorsAsArray
public Color[] getInputColorsAsArray()
-
getXMLInputColors
public Collection getXMLInputColors()
For java2xml- Returns:
- Returns the inputColors.
-
addXMLInputColor
public void addXMLInputColor(Color color)
For java2xml- Parameters:
color- the color to add
-
getStepsXML
public int getStepsXML()
For java2xml- Returns:
- the number of steps to cross fade from color A to color C
-
setStepsXML
public void setStepsXML(int steps)
For java2xml- Parameters:
steps- number of steps
-
-