1 /* SystemColor.java -- Class to access system color values.
2 Copyright (C) 1999 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
42 * This class contains the various "system colors" in use by the
43 * native windowing system.
45 * @author Aaron M. Renn (arenn@urbanophile.com)
47 public final class SystemColor extends Color implements java.io.Serializable
55 * Array index of the desktop color. Used by
56 * <code>Toolkit.loadSystemColors()</code>.
58 public static final int DESKTOP = 0;
61 * Array index of the active caption color. Used by
62 * <code>Toolkit.loadSystemColors()</code>.
64 public static final int ACTIVE_CAPTION = 1;
67 * Array index of the active caption text color. Used by
68 * <code>Toolkit.loadSystemColors()</code>.
70 public static final int ACTIVE_CAPTION_TEXT = 2;
73 * Array index of the active caption border color. Used by
74 * <code>Toolkit.loadSystemColors()</code>.
76 public static final int ACTIVE_CAPTION_BORDER = 3;
79 * Array index of the inactive caption color. Used by
80 * <code>Toolkit.loadSystemColors()</code>.
82 public static final int INACTIVE_CAPTION = 4;
85 * Array index of the inactive caption text color. Used by
86 * <code>Toolkit.loadSystemColors()</code>.
88 public static final int INACTIVE_CAPTION_TEXT = 5;
91 * Array index of the inactive caption border color. Used by
92 * <code>Toolkit.loadSystemColors()</code>.
94 public static final int INACTIVE_CAPTION_BORDER = 6;
97 * Array index of the window background color. Used by
98 * <code>Toolkit.loadSystemColors()</code>.
100 public static final int WINDOW = 7;
103 * Array index of the window border color. Used by
104 * <code>Toolkit.loadSystemColors()</code>.
106 public static final int WINDOW_BORDER = 8;
109 * Array index of the window text color. Used by
110 * <code>Toolkit.loadSystemColors()</code>.
112 public static final int WINDOW_TEXT = 9;
115 * Array index of the menu background color. Used by
116 * <code>Toolkit.loadSystemColors()</code>.
118 public static final int MENU = 10;
121 * Array index of the menu text color. Used by
122 * <code>Toolkit.loadSystemColors()</code>.
124 public static final int MENU_TEXT = 11;
127 * Array index of the text background color. Used by
128 * <code>Toolkit.loadSystemColors()</code>.
130 public static final int TEXT = 12;
133 * Array index of the text foreground color. Used by
134 * <code>Toolkit.loadSystemColors()</code>.
136 public static final int TEXT_TEXT = 13;
139 * Array index of the highlighted text background color. Used by
140 * <code>Toolkit.loadSystemColors()</code>.
142 public static final int TEXT_HIGHLIGHT = 14;
145 * Array index of the highlighted text foreground color. Used by
146 * <code>Toolkit.loadSystemColors()</code>.
148 public static final int TEXT_HIGHLIGHT_TEXT = 15;
151 * Array index of the inactive text foreground color. Used by
152 * <code>Toolkit.loadSystemColors()</code>.
154 public static final int TEXT_INACTIVE_TEXT = 16;
157 * Array index of the control background color. Used by
158 * <code>Toolkit.loadSystemColors()</code>.
160 public static final int CONTROL = 17;
163 * Array index of the control text color. Used by
164 * <code>Toolkit.loadSystemColors()</code>.
166 public static final int CONTROL_TEXT = 18;
169 * Array index of the highlighted control background color. Used by
170 * <code>Toolkit.loadSystemColors()</code>.
172 public static final int CONTROL_HIGHLIGHT = 19;
175 * Array index of the lightly highlighted control background color. Used by
176 * <code>Toolkit.loadSystemColors()</code>.
178 public static final int CONTROL_LT_HIGHLIGHT = 20;
181 * Array index of the shadowed control background color. Used by
182 * <code>Toolkit.loadSystemColors()</code>.
184 public static final int CONTROL_SHADOW = 21;
187 * Array index of the darkly shadowed control background color. Used by
188 * <code>Toolkit.loadSystemColors()</code>.
190 public static final int CONTROL_DK_SHADOW = 22;
193 * Array index of the scrollbar background color. Used by
194 * <code>Toolkit.loadSystemColors()</code>.
196 public static final int SCROLLBAR = 23;
199 * Array index of the info background color. Used by
200 * <code>Toolkit.loadSystemColors()</code>.
202 public static final int INFO = 24;
205 * Array index of the info text color. Used by
206 * <code>Toolkit.loadSystemColors()</code>.
208 public static final int INFO_TEXT = 25;
211 * The number of system colors. Used by
212 * <code>Toolkit.loadSystemColors()</code>.
214 public static final int NUM_COLORS = 26;
219 public static final SystemColor desktop;
222 * The active caption background color.
224 public static final SystemColor activeCaption;
227 * The active caption text color.
229 public static final SystemColor activeCaptionText;
232 * The active caption border color.
234 public static final SystemColor activeCaptionBorder;
237 * The inactive caption background color.
239 public static final SystemColor inactiveCaption;
242 * The inactive caption text color.
244 public static final SystemColor inactiveCaptionText;
247 * The inactive caption border color.
249 public static final SystemColor inactiveCaptionBorder;
252 * The window background color.
254 public static final SystemColor window;
257 * The window border color.
259 public static final SystemColor windowBorder;
262 * The window text color.
264 public static final SystemColor windowText;
267 * The menu background color.
269 public static final SystemColor menu;
272 * The menu text color.
274 public static final SystemColor menuText;
277 * The text background color.
279 public static final SystemColor text;
282 * The text foreground color.
284 public static final SystemColor textText;
287 * The highlighted text background color.
289 public static final SystemColor textHighlight;
292 * The highlighted text foreground color.
294 public static final SystemColor textHighlightText;
297 * The inactive text color.
299 public static final SystemColor textInactiveText;
302 * The control background color.
304 public static final SystemColor control;
307 * The control text color.
309 public static final SystemColor controlText;
312 * The control highlight color.
314 public static final SystemColor controlHighlight;
317 * The control light highlight color.
319 public static final SystemColor controlLtHighlight;
322 * The control shadow color.
324 public static final SystemColor controlShadow;
327 * The control dark shadow color.
329 public static final SystemColor controlDkShadow;
332 * The scrollbar color.
334 public static final SystemColor scrollbar;
337 * The info text background color.
339 public static final SystemColor info;
342 * The info text foreground color.
344 public static final SystemColor infoText;
346 // Serialization version constant
347 private static final long serialVersionUID = 4503142729533789064L;
351 int[] sys_color_rgbs = new int[NUM_COLORS];
352 Toolkit.getDefaultToolkit().loadSystemColors(sys_color_rgbs);
354 desktop = new SystemColor(sys_color_rgbs[DESKTOP]);
355 activeCaption= new SystemColor(sys_color_rgbs[ACTIVE_CAPTION]);
356 activeCaptionText= new SystemColor(sys_color_rgbs[ACTIVE_CAPTION_TEXT]);
357 activeCaptionBorder = new SystemColor(sys_color_rgbs[ACTIVE_CAPTION_BORDER]);
358 inactiveCaption = new SystemColor(sys_color_rgbs[INACTIVE_CAPTION]);
359 inactiveCaptionText = new SystemColor(sys_color_rgbs[INACTIVE_CAPTION_TEXT]);
360 inactiveCaptionBorder =
361 new SystemColor(sys_color_rgbs[INACTIVE_CAPTION_BORDER]);
362 window = new SystemColor(sys_color_rgbs[WINDOW]);
363 windowBorder = new SystemColor(sys_color_rgbs[WINDOW_BORDER]);
364 windowText = new SystemColor(sys_color_rgbs[WINDOW_TEXT]);
365 menu = new SystemColor(sys_color_rgbs[MENU]);
366 menuText = new SystemColor(sys_color_rgbs[MENU_TEXT]);
367 text = new SystemColor(sys_color_rgbs[TEXT]);
368 textText = new SystemColor(sys_color_rgbs[TEXT_TEXT]);
369 textHighlight = new SystemColor(sys_color_rgbs[TEXT_HIGHLIGHT]);
370 textHighlightText = new SystemColor(sys_color_rgbs[TEXT_HIGHLIGHT_TEXT]);
371 textInactiveText = new SystemColor(sys_color_rgbs[TEXT_INACTIVE_TEXT]);
372 control = new SystemColor(sys_color_rgbs[CONTROL]);
373 controlText = new SystemColor(sys_color_rgbs[CONTROL_TEXT]);
374 controlHighlight = new SystemColor(sys_color_rgbs[CONTROL_HIGHLIGHT]);
375 controlLtHighlight = new SystemColor(sys_color_rgbs[CONTROL_LT_HIGHLIGHT]);
376 controlShadow = new SystemColor(sys_color_rgbs[CONTROL_SHADOW]);
377 controlDkShadow = new SystemColor(sys_color_rgbs[CONTROL_DK_SHADOW]);
378 scrollbar = new SystemColor(sys_color_rgbs[SCROLLBAR]);
379 info = new SystemColor(sys_color_rgbs[INFO]);
380 infoText = new SystemColor(sys_color_rgbs[INFO_TEXT]);
383 /*************************************************************************/
395 /*************************************************************************/
402 * Returns the RGB value for this color as an <code>int</code>. The first
403 * byte is the blue value, the second the green value, the third the
404 * red value and the fourth is set to 0xFF.
406 * @return The RGB value.
411 // Override only to be spec consistent.
412 return(super.getRGB());
415 /*************************************************************************/
418 * Returns a string describing this color.
420 * @return A string describing this color.
425 return("SystemColor(R=" + getRed() + ",G=" + getGreen() + ",B=" +
429 } // class SystemColor