1 /* 2 * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package java.awt; 26 27 import java.io.ObjectStreamException; 28 29 import javax.tools.annotation.GenerateNativeHeader; 30 31 /** 32 * A class to encapsulate symbolic colors representing the color of 33 * native GUI objects on a system. For systems which support the dynamic 34 * update of the system colors (when the user changes the colors) 35 * the actual RGB values of these symbolic colors will also change 36 * dynamically. In order to compare the "current" RGB value of a 37 * <code>SystemColor</code> object with a non-symbolic Color object, 38 * <code>getRGB</code> should be used rather than <code>equals</code>. 39 * <p> 40 * Note that the way in which these system colors are applied to GUI objects 41 * may vary slightly from platform to platform since GUI objects may be 42 * rendered differently on each platform. 43 * <p> 44 * System color values may also be available through the <code>getDesktopProperty</code> 45 * method on <code>java.awt.Toolkit</code>. 46 * 47 * @see Toolkit#getDesktopProperty 48 * 49 * @author Carl Quinn 50 * @author Amy Fowler 51 */ 52 /* No native methods here, but the constants are needed in the supporting JNI code */ 53 @GenerateNativeHeader 54 public final class SystemColor extends Color implements java.io.Serializable { 55 56 /** 57 * The array index for the 58 * {@link #desktop} system color. 59 * @see SystemColor#desktop 60 */ 61 public final static int DESKTOP = 0; 62 63 /** 64 * The array index for the 65 * {@link #activeCaption} system color. 66 * @see SystemColor#activeCaption 67 */ 68 public final static int ACTIVE_CAPTION = 1; 69 70 /** 71 * The array index for the 72 * {@link #activeCaptionText} system color. 73 * @see SystemColor#activeCaptionText 74 */ 75 public final static int ACTIVE_CAPTION_TEXT = 2; 76 77 /** 78 * The array index for the 79 * {@link #activeCaptionBorder} system color. 80 * @see SystemColor#activeCaptionBorder 81 */ 82 public final static int ACTIVE_CAPTION_BORDER = 3; 83 84 /** 85 * The array index for the 86 * {@link #inactiveCaption} system color. 87 * @see SystemColor#inactiveCaption 88 */ 89 public final static int INACTIVE_CAPTION = 4; 90 91 /** 92 * The array index for the 93 * {@link #inactiveCaptionText} system color. 94 * @see SystemColor#inactiveCaptionText 95 */ 96 public final static int INACTIVE_CAPTION_TEXT = 5; 97 98 /** 99 * The array index for the 100 * {@link #inactiveCaptionBorder} system color. 101 * @see SystemColor#inactiveCaptionBorder 102 */ 103 public final static int INACTIVE_CAPTION_BORDER = 6; 104 105 /** 106 * The array index for the 107 * {@link #window} system color. 108 * @see SystemColor#window 109 */ 110 public final static int WINDOW = 7; 111 112 /** 113 * The array index for the 114 * {@link #windowBorder} system color. 115 * @see SystemColor#windowBorder 116 */ 117 public final static int WINDOW_BORDER = 8; 118 119 /** 120 * The array index for the 121 * {@link #windowText} system color. 122 * @see SystemColor#windowText 123 */ 124 public final static int WINDOW_TEXT = 9; 125 126 /** 127 * The array index for the 128 * {@link #menu} system color. 129 * @see SystemColor#menu 130 */ 131 public final static int MENU = 10; 132 133 /** 134 * The array index for the 135 * {@link #menuText} system color. 136 * @see SystemColor#menuText 137 */ 138 public final static int MENU_TEXT = 11; 139 140 /** 141 * The array index for the 142 * {@link #text} system color. 143 * @see SystemColor#text 144 */ 145 public final static int TEXT = 12; 146 147 /** 148 * The array index for the 149 * {@link #textText} system color. 150 * @see SystemColor#textText 151 */ 152 public final static int TEXT_TEXT = 13; 153 154 /** 155 * The array index for the 156 * {@link #textHighlight} system color. 157 * @see SystemColor#textHighlight 158 */ 159 public final static int TEXT_HIGHLIGHT = 14; 160 161 /** 162 * The array index for the 163 * {@link #textHighlightText} system color. 164 * @see SystemColor#textHighlightText 165 */ 166 public final static int TEXT_HIGHLIGHT_TEXT = 15; 167 168 /** 169 * The array index for the 170 * {@link #textInactiveText} system color. 171 * @see SystemColor#textInactiveText 172 */ 173 public final static int TEXT_INACTIVE_TEXT = 16; 174 175 /** 176 * The array index for the 177 * {@link #control} system color. 178 * @see SystemColor#control 179 */ 180 public final static int CONTROL = 17; 181 182 /** 183 * The array index for the 184 * {@link #controlText} system color. 185 * @see SystemColor#controlText 186 */ 187 public final static int CONTROL_TEXT = 18; 188 189 /** 190 * The array index for the 191 * {@link #controlHighlight} system color. 192 * @see SystemColor#controlHighlight 193 */ 194 public final static int CONTROL_HIGHLIGHT = 19; 195 196 /** 197 * The array index for the 198 * {@link #controlLtHighlight} system color. 199 * @see SystemColor#controlLtHighlight 200 */ 201 public final static int CONTROL_LT_HIGHLIGHT = 20; 202 203 /** 204 * The array index for the 205 * {@link #controlShadow} system color. 206 * @see SystemColor#controlShadow 207 */ 208 public final static int CONTROL_SHADOW = 21; 209 210 /** 211 * The array index for the 212 * {@link #controlDkShadow} system color. 213 * @see SystemColor#controlDkShadow 214 */ 215 public final static int CONTROL_DK_SHADOW = 22; 216 217 /** 218 * The array index for the 219 * {@link #scrollbar} system color. 220 * @see SystemColor#scrollbar 221 */ 222 public final static int SCROLLBAR = 23; 223 224 /** 225 * The array index for the 226 * {@link #info} system color. 227 * @see SystemColor#info 228 */ 229 public final static int INFO = 24; 230 231 /** 232 * The array index for the 233 * {@link #infoText} system color. 234 * @see SystemColor#infoText 235 */ 236 public final static int INFO_TEXT = 25; 237 238 /** 239 * The number of system colors in the array. 240 */ 241 public final static int NUM_COLORS = 26; 242 243 /******************************************************************************************/ 244 245 /* 246 * System colors with default initial values, overwritten by toolkit if 247 * system values differ and are available. 248 * Should put array initialization above first field that is using 249 * SystemColor constructor to initialize. 250 */ 251 private static int[] systemColors = { 252 0xFF005C5C, // desktop = new Color(0,92,92); 253 0xFF000080, // activeCaption = new Color(0,0,128); 254 0xFFFFFFFF, // activeCaptionText = Color.white; 255 0xFFC0C0C0, // activeCaptionBorder = Color.lightGray; 256 0xFF808080, // inactiveCaption = Color.gray; 257 0xFFC0C0C0, // inactiveCaptionText = Color.lightGray; 258 0xFFC0C0C0, // inactiveCaptionBorder = Color.lightGray; 259 0xFFFFFFFF, // window = Color.white; 260 0xFF000000, // windowBorder = Color.black; 261 0xFF000000, // windowText = Color.black; | 1 /* 2 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package java.awt; 26 27 import java.io.ObjectStreamException; 28 29 import java.lang.annotation.Native; 30 31 /** 32 * A class to encapsulate symbolic colors representing the color of 33 * native GUI objects on a system. For systems which support the dynamic 34 * update of the system colors (when the user changes the colors) 35 * the actual RGB values of these symbolic colors will also change 36 * dynamically. In order to compare the "current" RGB value of a 37 * <code>SystemColor</code> object with a non-symbolic Color object, 38 * <code>getRGB</code> should be used rather than <code>equals</code>. 39 * <p> 40 * Note that the way in which these system colors are applied to GUI objects 41 * may vary slightly from platform to platform since GUI objects may be 42 * rendered differently on each platform. 43 * <p> 44 * System color values may also be available through the <code>getDesktopProperty</code> 45 * method on <code>java.awt.Toolkit</code>. 46 * 47 * @see Toolkit#getDesktopProperty 48 * 49 * @author Carl Quinn 50 * @author Amy Fowler 51 */ 52 public final class SystemColor extends Color implements java.io.Serializable { 53 54 /** 55 * The array index for the 56 * {@link #desktop} system color. 57 * @see SystemColor#desktop 58 */ 59 @Native public final static int DESKTOP = 0; 60 61 /** 62 * The array index for the 63 * {@link #activeCaption} system color. 64 * @see SystemColor#activeCaption 65 */ 66 @Native public final static int ACTIVE_CAPTION = 1; 67 68 /** 69 * The array index for the 70 * {@link #activeCaptionText} system color. 71 * @see SystemColor#activeCaptionText 72 */ 73 @Native public final static int ACTIVE_CAPTION_TEXT = 2; 74 75 /** 76 * The array index for the 77 * {@link #activeCaptionBorder} system color. 78 * @see SystemColor#activeCaptionBorder 79 */ 80 @Native public final static int ACTIVE_CAPTION_BORDER = 3; 81 82 /** 83 * The array index for the 84 * {@link #inactiveCaption} system color. 85 * @see SystemColor#inactiveCaption 86 */ 87 @Native public final static int INACTIVE_CAPTION = 4; 88 89 /** 90 * The array index for the 91 * {@link #inactiveCaptionText} system color. 92 * @see SystemColor#inactiveCaptionText 93 */ 94 @Native public final static int INACTIVE_CAPTION_TEXT = 5; 95 96 /** 97 * The array index for the 98 * {@link #inactiveCaptionBorder} system color. 99 * @see SystemColor#inactiveCaptionBorder 100 */ 101 @Native public final static int INACTIVE_CAPTION_BORDER = 6; 102 103 /** 104 * The array index for the 105 * {@link #window} system color. 106 * @see SystemColor#window 107 */ 108 @Native public final static int WINDOW = 7; 109 110 /** 111 * The array index for the 112 * {@link #windowBorder} system color. 113 * @see SystemColor#windowBorder 114 */ 115 @Native public final static int WINDOW_BORDER = 8; 116 117 /** 118 * The array index for the 119 * {@link #windowText} system color. 120 * @see SystemColor#windowText 121 */ 122 @Native public final static int WINDOW_TEXT = 9; 123 124 /** 125 * The array index for the 126 * {@link #menu} system color. 127 * @see SystemColor#menu 128 */ 129 @Native public final static int MENU = 10; 130 131 /** 132 * The array index for the 133 * {@link #menuText} system color. 134 * @see SystemColor#menuText 135 */ 136 @Native public final static int MENU_TEXT = 11; 137 138 /** 139 * The array index for the 140 * {@link #text} system color. 141 * @see SystemColor#text 142 */ 143 @Native public final static int TEXT = 12; 144 145 /** 146 * The array index for the 147 * {@link #textText} system color. 148 * @see SystemColor#textText 149 */ 150 @Native public final static int TEXT_TEXT = 13; 151 152 /** 153 * The array index for the 154 * {@link #textHighlight} system color. 155 * @see SystemColor#textHighlight 156 */ 157 @Native public final static int TEXT_HIGHLIGHT = 14; 158 159 /** 160 * The array index for the 161 * {@link #textHighlightText} system color. 162 * @see SystemColor#textHighlightText 163 */ 164 @Native public final static int TEXT_HIGHLIGHT_TEXT = 15; 165 166 /** 167 * The array index for the 168 * {@link #textInactiveText} system color. 169 * @see SystemColor#textInactiveText 170 */ 171 @Native public final static int TEXT_INACTIVE_TEXT = 16; 172 173 /** 174 * The array index for the 175 * {@link #control} system color. 176 * @see SystemColor#control 177 */ 178 @Native public final static int CONTROL = 17; 179 180 /** 181 * The array index for the 182 * {@link #controlText} system color. 183 * @see SystemColor#controlText 184 */ 185 @Native public final static int CONTROL_TEXT = 18; 186 187 /** 188 * The array index for the 189 * {@link #controlHighlight} system color. 190 * @see SystemColor#controlHighlight 191 */ 192 @Native public final static int CONTROL_HIGHLIGHT = 19; 193 194 /** 195 * The array index for the 196 * {@link #controlLtHighlight} system color. 197 * @see SystemColor#controlLtHighlight 198 */ 199 @Native public final static int CONTROL_LT_HIGHLIGHT = 20; 200 201 /** 202 * The array index for the 203 * {@link #controlShadow} system color. 204 * @see SystemColor#controlShadow 205 */ 206 @Native public final static int CONTROL_SHADOW = 21; 207 208 /** 209 * The array index for the 210 * {@link #controlDkShadow} system color. 211 * @see SystemColor#controlDkShadow 212 */ 213 @Native public final static int CONTROL_DK_SHADOW = 22; 214 215 /** 216 * The array index for the 217 * {@link #scrollbar} system color. 218 * @see SystemColor#scrollbar 219 */ 220 @Native public final static int SCROLLBAR = 23; 221 222 /** 223 * The array index for the 224 * {@link #info} system color. 225 * @see SystemColor#info 226 */ 227 @Native public final static int INFO = 24; 228 229 /** 230 * The array index for the 231 * {@link #infoText} system color. 232 * @see SystemColor#infoText 233 */ 234 @Native public final static int INFO_TEXT = 25; 235 236 /** 237 * The number of system colors in the array. 238 */ 239 @Native public final static int NUM_COLORS = 26; 240 241 /******************************************************************************************/ 242 243 /* 244 * System colors with default initial values, overwritten by toolkit if 245 * system values differ and are available. 246 * Should put array initialization above first field that is using 247 * SystemColor constructor to initialize. 248 */ 249 private static int[] systemColors = { 250 0xFF005C5C, // desktop = new Color(0,92,92); 251 0xFF000080, // activeCaption = new Color(0,0,128); 252 0xFFFFFFFF, // activeCaptionText = Color.white; 253 0xFFC0C0C0, // activeCaptionBorder = Color.lightGray; 254 0xFF808080, // inactiveCaption = Color.gray; 255 0xFFC0C0C0, // inactiveCaptionText = Color.lightGray; 256 0xFFC0C0C0, // inactiveCaptionBorder = Color.lightGray; 257 0xFFFFFFFF, // window = Color.white; 258 0xFF000000, // windowBorder = Color.black; 259 0xFF000000, // windowText = Color.black; |