1 7 package java.awt; 8 9 import java.awt.geom.AffineTransform ; 10 import java.awt.geom.Rectangle2D ; 11 import java.awt.image.ColorModel ; 12 13 35 public final class SystemColor extends Color implements java.io.Serializable { 36 37 42 public final static int DESKTOP = 0; 43 44 49 public final static int ACTIVE_CAPTION = 1; 50 51 56 public final static int ACTIVE_CAPTION_TEXT = 2; 57 58 63 public final static int ACTIVE_CAPTION_BORDER = 3; 64 65 70 public final static int INACTIVE_CAPTION = 4; 71 72 77 public final static int INACTIVE_CAPTION_TEXT = 5; 78 79 84 public final static int INACTIVE_CAPTION_BORDER = 6; 85 86 91 public final static int WINDOW = 7; 92 93 98 public final static int WINDOW_BORDER = 8; 99 100 105 public final static int WINDOW_TEXT = 9; 106 107 112 public final static int MENU = 10; 113 114 119 public final static int MENU_TEXT = 11; 120 121 126 public final static int TEXT = 12; 127 128 133 public final static int TEXT_TEXT = 13; 134 135 140 public final static int TEXT_HIGHLIGHT = 14; 141 142 147 public final static int TEXT_HIGHLIGHT_TEXT = 15; 148 149 154 public final static int TEXT_INACTIVE_TEXT = 16; 155 156 161 public final static int CONTROL = 17; 162 163 168 public final static int CONTROL_TEXT = 18; 169 170 175 public final static int CONTROL_HIGHLIGHT = 19; 176 177 182 public final static int CONTROL_LT_HIGHLIGHT = 20; 183 184 189 public final static int CONTROL_SHADOW = 21; 190 191 196 public final static int CONTROL_DK_SHADOW = 22; 197 198 203 public final static int SCROLLBAR = 23; 204 205 210 public final static int INFO = 24; 211 212 217 public final static int INFO_TEXT = 25; 218 219 222 public final static int NUM_COLORS = 26; 223 224 225 226 229 public final static SystemColor desktop = new SystemColor ((byte)DESKTOP); 230 231 234 public final static SystemColor activeCaption = new SystemColor ((byte)ACTIVE_CAPTION); 235 236 239 public final static SystemColor activeCaptionText = new SystemColor ((byte)ACTIVE_CAPTION_TEXT); 240 241 244 public final static SystemColor activeCaptionBorder = new SystemColor ((byte)ACTIVE_CAPTION_BORDER); 245 246 249 public final static SystemColor inactiveCaption = new SystemColor ((byte)INACTIVE_CAPTION); 250 251 254 public final static SystemColor inactiveCaptionText = new SystemColor ((byte)INACTIVE_CAPTION_TEXT); 255 256 259 public final static SystemColor inactiveCaptionBorder = new SystemColor ((byte)INACTIVE_CAPTION_BORDER); 260 261 264 public final static SystemColor window = new SystemColor ((byte)WINDOW); 265 266 269 public final static SystemColor windowBorder = new SystemColor ((byte)WINDOW_BORDER); 270 271 274 public final static SystemColor windowText = new SystemColor ((byte)WINDOW_TEXT); 275 276 279 public final static SystemColor menu = new SystemColor ((byte)MENU); 280 281 284 public final static SystemColor menuText = new SystemColor ((byte)MENU_TEXT); 285 286 290 public final static SystemColor text = new SystemColor ((byte)TEXT); 291 292 296 public final static SystemColor textText = new SystemColor ((byte)TEXT_TEXT); 297 298 302 public final static SystemColor textHighlight = new SystemColor ((byte)TEXT_HIGHLIGHT); 303 304 308 public final static SystemColor textHighlightText = new SystemColor ((byte)TEXT_HIGHLIGHT_TEXT); 309 310 313 public final static SystemColor textInactiveText = new SystemColor ((byte)TEXT_INACTIVE_TEXT); 314 315 319 public final static SystemColor control = new SystemColor ((byte)CONTROL); 320 321 325 public final static SystemColor controlText = new SystemColor ((byte)CONTROL_TEXT); 326 327 332 public final static SystemColor controlHighlight = new SystemColor ((byte)CONTROL_HIGHLIGHT); 333 334 339 public final static SystemColor controlLtHighlight = new SystemColor ((byte)CONTROL_LT_HIGHLIGHT); 340 341 346 public final static SystemColor controlShadow = new SystemColor ((byte)CONTROL_SHADOW); 347 348 353 public final static SystemColor controlDkShadow = new SystemColor ((byte)CONTROL_DK_SHADOW); 354 355 358 public final static SystemColor scrollbar = new SystemColor ((byte)SCROLLBAR); 359 360 363 public final static SystemColor info = new SystemColor ((byte)INFO); 364 365 368 public final static SystemColor infoText = new SystemColor ((byte)INFO_TEXT); 369 370 374 private static int[] systemColors = { 375 0xFF005C5C, 0xFF000080, 0xFFFFFFFF, 0xFFC0C0C0, 0xFF808080, 0xFFC0C0C0, 0xFFC0C0C0, 0xFFFFFFFF, 0xFF000000, 0xFF000000, 0xFFC0C0C0, 0xFF000000, 0xFFC0C0C0, 0xFF000000, 0xFF000080, 0xFFFFFFFF, 0xFF808080, 0xFFC0C0C0, 0xFF000000, 0xFFFFFFFF, 0xFFE0E0E0, 0xFF808080, 0xFF000000, 0xFFE0E0E0, 0xFFE0E000, 0xFF000000, }; 402 403 406 private static final long serialVersionUID = 4503142729533789064L; 407 408 static { 409 updateSystemColors(); 410 } 411 412 415 private static void updateSystemColors() { 416 if (!GraphicsEnvironment.isHeadless()) { 417 Toolkit.getDefaultToolkit().loadSystemColors(systemColors); 418 } 419 } 420 421 425 private SystemColor(byte index) { 426 super(0, 0, 0); 427 value = index; 428 } 429 430 438 public int getRGB() { 441 return systemColors[value]; 442 } 443 444 453 public PaintContext createContext(ColorModel cm, Rectangle r, 454 Rectangle2D r2d, AffineTransform xform, 455 RenderingHints hints) { 456 return new ColorPaintContext (value, cm); 457 } 458 459 468 public String toString() { 469 return getClass().getName() + "[i=" + (value) + "]"; 470 } 471 472 } 473 | Popular Tags |