KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > ChartColor


1 /* ===========================================================
2  * JFreeChart : a free chart library for the Java(tm) platform
3  * ===========================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jfreechart/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this library; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
24  * in the United States and other countries.]
25  *
26  * ---------------
27  * ChartColor.java
28  * ---------------
29  * (C) Copyright 2003, 2004, by Cameron Riley and Contributors.
30  *
31  * Original Author: Cameron Riley;
32  * Contributor(s): David Gilbert (for Object Refinery Limited);
33  *
34  * $Id: ChartColor.java,v 1.3 2005/02/09 17:08:08 mungady Exp $
35  *
36  * Changes
37  * -------
38  * 23-Jan-2003 : Version 1, contributed by Cameron Riley (DG);
39  * 25-Nov-2004 : Changed first 7 colors to softer shades (DG);
40  *
41  */

42
43 package org.jfree.chart;
44
45 import java.awt.Color JavaDoc;
46 import java.awt.Paint JavaDoc;
47
48 /**
49  * Class to extend the number of Colors available to the charts. This
50  * extends the java.awt.Color object and extends the number of final
51  * Colors publically accessible.
52  *
53  * @author <a HREF="criley@ekmail.com">Cameron Riley</a>
54  */

55 public class ChartColor extends Color JavaDoc {
56
57     /** A very dark red color. */
58     public static final Color JavaDoc VERY_DARK_RED = new Color JavaDoc(0x80, 0x00, 0x00);
59
60     /** A dark red color. */
61     public static final Color JavaDoc DARK_RED = new Color JavaDoc(0xc0, 0x00, 0x00);
62
63     /** A light red color. */
64     public static final Color JavaDoc LIGHT_RED = new Color JavaDoc(0xFF, 0x40, 0x40);
65
66     /** A very light red color. */
67     public static final Color JavaDoc VERY_LIGHT_RED = new Color JavaDoc(0xFF, 0x80, 0x80);
68
69     /** A very dark yellow color. */
70     public static final Color JavaDoc VERY_DARK_YELLOW = new Color JavaDoc(0x80, 0x80, 0x00);
71
72     /** A dark yellow color. */
73     public static final Color JavaDoc DARK_YELLOW = new Color JavaDoc(0xC0, 0xC0, 0x00);
74
75     /** A light yellow color. */
76     public static final Color JavaDoc LIGHT_YELLOW = new Color JavaDoc(0xFF, 0xFF, 0x40);
77
78     /** A very light yellow color. */
79     public static final Color JavaDoc VERY_LIGHT_YELLOW = new Color JavaDoc(0xFF, 0xFF, 0x80);
80
81     /** A very dark green color. */
82     public static final Color JavaDoc VERY_DARK_GREEN = new Color JavaDoc(0x00, 0x80, 0x00);
83
84     /** A dark green color. */
85     public static final Color JavaDoc DARK_GREEN = new Color JavaDoc(0x00, 0xC0, 0x00);
86
87     /** A light green color. */
88     public static final Color JavaDoc LIGHT_GREEN = new Color JavaDoc(0x40, 0xFF, 0x40);
89
90     /** A very light green color. */
91     public static final Color JavaDoc VERY_LIGHT_GREEN = new Color JavaDoc(0x80, 0xFF, 0x80);
92
93     /** A very dark cyan color. */
94     public static final Color JavaDoc VERY_DARK_CYAN = new Color JavaDoc(0x00, 0x80, 0x80);
95
96     /** A dark cyan color. */
97     public static final Color JavaDoc DARK_CYAN = new Color JavaDoc(0x00, 0xC0, 0xC0);
98
99     /** A light cyan color. */
100     public static final Color JavaDoc LIGHT_CYAN = new Color JavaDoc(0x40, 0xFF, 0xFF);
101
102     /** Aa very light cyan color. */
103     public static final Color JavaDoc VERY_LIGHT_CYAN = new Color JavaDoc(0x80, 0xFF, 0xFF);
104
105     /** A very dark blue color. */
106     public static final Color JavaDoc VERY_DARK_BLUE = new Color JavaDoc(0x00, 0x00, 0x80);
107
108     /** A dark blue color. */
109     public static final Color JavaDoc DARK_BLUE = new Color JavaDoc(0x00, 0x00, 0xC0);
110
111     /** A light blue color. */
112     public static final Color JavaDoc LIGHT_BLUE = new Color JavaDoc(0x40, 0x40, 0xFF);
113
114     /** A very light blue color. */
115     public static final Color JavaDoc VERY_LIGHT_BLUE = new Color JavaDoc(0x80, 0x80, 0xFF);
116
117     /** A very dark magenta/purple color. */
118     public static final Color JavaDoc VERY_DARK_MAGENTA = new Color JavaDoc(0x80, 0x00, 0x80);
119
120     /** A dark magenta color. */
121     public static final Color JavaDoc DARK_MAGENTA = new Color JavaDoc(0xC0, 0x00, 0xC0);
122
123     /** A light magenta color. */
124     public static final Color JavaDoc LIGHT_MAGENTA = new Color JavaDoc(0xFF, 0x40, 0xFF);
125
126     /** A very light magenta color. */
127     public static final Color JavaDoc VERY_LIGHT_MAGENTA = new Color JavaDoc(0xFF, 0x80, 0xFF);
128
129     /**
130      * Creates a Color with an opaque sRGB with red, green and blue values in
131      * range 0-255.
132      *
133      * @param r the red component in range 0x00-0xFF.
134      * @param g the green component in range 0x00-0xFF.
135      * @param b the blue component in range 0x00-0xFF.
136      */

137     public ChartColor(int r, int g, int b) {
138         super(r, g, b);
139     }
140
141     /**
142      * Convenience method to return an array of <code>Paint</code> objects that
143      * represent the pre-defined colors in the <code>Color<code> and
144      * <code>ChartColor</code> objects.
145      *
146      * @return An array of objects with the <code>Paint</code> interface.
147      */

148     public static Paint JavaDoc[] createDefaultPaintArray() {
149
150         return new Paint JavaDoc[] {
151             new Color JavaDoc(0xFF, 0x55, 0x55),
152             new Color JavaDoc(0x55, 0x55, 0xFF),
153             new Color JavaDoc(0x55, 0xFF, 0x55),
154             new Color JavaDoc(0xFF, 0xFF, 0x55),
155             new Color JavaDoc(0xFF, 0xBB, 0x55),
156             new Color JavaDoc(0xFF, 0x55, 0xFF),
157             new Color JavaDoc(0x55, 0xFF, 0xFF),
158             Color.pink,
159             Color.gray,
160             ChartColor.DARK_RED,
161             ChartColor.DARK_BLUE,
162             ChartColor.DARK_GREEN,
163             ChartColor.DARK_YELLOW,
164             ChartColor.DARK_MAGENTA,
165             ChartColor.DARK_CYAN,
166             Color.darkGray,
167             ChartColor.LIGHT_RED,
168             ChartColor.LIGHT_BLUE,
169             ChartColor.LIGHT_GREEN,
170             ChartColor.LIGHT_YELLOW,
171             ChartColor.LIGHT_MAGENTA,
172             ChartColor.LIGHT_CYAN,
173             Color.lightGray,
174             ChartColor.VERY_DARK_RED,
175             ChartColor.VERY_DARK_BLUE,
176             ChartColor.VERY_DARK_GREEN,
177             ChartColor.VERY_DARK_YELLOW,
178             ChartColor.VERY_DARK_MAGENTA,
179             ChartColor.VERY_DARK_CYAN,
180             ChartColor.VERY_LIGHT_RED,
181             ChartColor.VERY_LIGHT_BLUE,
182             ChartColor.VERY_LIGHT_GREEN,
183             ChartColor.VERY_LIGHT_YELLOW,
184             ChartColor.VERY_LIGHT_MAGENTA,
185             ChartColor.VERY_LIGHT_CYAN
186         };
187     }
188
189 }
190
Popular Tags