jdk/src/share/classes/java/awt/SystemColor.java
author erikj
Thu, 07 Jun 2012 18:05:09 -0700
changeset 12813 c10ab96dcf41
parent 5506 202f599c92aa
child 16734 da1901d79073
permissions -rw-r--r--
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI Reviewed-by: ohair, ohrstrom, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.io.ObjectStreamException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    29
import javax.tools.annotation.GenerateNativeHeader;
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    30
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * A class to encapsulate symbolic colors representing the color of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * native GUI objects on a system.  For systems which support the dynamic
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * update of the system colors (when the user changes the colors)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * the actual RGB values of these symbolic colors will also change
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * dynamically.  In order to compare the "current" RGB value of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <code>SystemColor</code> object with a non-symbolic Color object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <code>getRGB</code> should be used rather than <code>equals</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * Note that the way in which these system colors are applied to GUI objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * may vary slightly from platform to platform since GUI objects may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * rendered differently on each platform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * System color values may also be available through the <code>getDesktopProperty</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * method on <code>java.awt.Toolkit</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @see Toolkit#getDesktopProperty
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @author      Carl Quinn
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @author      Amy Fowler
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 */
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    52
/* No native methods here, but the constants are needed in the supporting JNI code */
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    53
@GenerateNativeHeader
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
public final class SystemColor extends Color implements java.io.Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * {@link #desktop} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * @see SystemColor#desktop
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    public final static int DESKTOP = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * {@link #activeCaption} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * @see SystemColor#activeCaption
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    public final static int ACTIVE_CAPTION = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * {@link #activeCaptionText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * @see SystemColor#activeCaptionText
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public final static int ACTIVE_CAPTION_TEXT = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * {@link #activeCaptionBorder} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @see SystemColor#activeCaptionBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public final static int ACTIVE_CAPTION_BORDER = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * {@link #inactiveCaption} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * @see SystemColor#inactiveCaption
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    public final static int INACTIVE_CAPTION = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * {@link #inactiveCaptionText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @see SystemColor#inactiveCaptionText
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public final static int INACTIVE_CAPTION_TEXT = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * {@link #inactiveCaptionBorder} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @see SystemColor#inactiveCaptionBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    public final static int INACTIVE_CAPTION_BORDER = 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * {@link #window} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @see SystemColor#window
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    public final static int WINDOW = 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * {@link #windowBorder} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @see SystemColor#windowBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    public final static int WINDOW_BORDER = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * {@link #windowText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * @see SystemColor#windowText
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    public final static int WINDOW_TEXT = 9;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * {@link #menu} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @see SystemColor#menu
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    public final static int MENU = 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * {@link #menuText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @see SystemColor#menuText
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    public final static int MENU_TEXT = 11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * {@link #text} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * @see SystemColor#text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public final static int TEXT = 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * {@link #textText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * @see SystemColor#textText
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    public final static int TEXT_TEXT = 13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * {@link #textHighlight} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @see SystemColor#textHighlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    public final static int TEXT_HIGHLIGHT = 14;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * {@link #textHighlightText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @see SystemColor#textHighlightText
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    public final static int TEXT_HIGHLIGHT_TEXT = 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * {@link #textInactiveText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @see SystemColor#textInactiveText
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    public final static int TEXT_INACTIVE_TEXT = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * {@link #control} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @see SystemColor#control
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    public final static int CONTROL = 17;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * {@link #controlText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * @see SystemColor#controlText
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    public final static int CONTROL_TEXT = 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * {@link #controlHighlight} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @see SystemColor#controlHighlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    public final static int CONTROL_HIGHLIGHT = 19;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * {@link #controlLtHighlight} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * @see SystemColor#controlLtHighlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    public final static int CONTROL_LT_HIGHLIGHT = 20;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * {@link #controlShadow} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * @see SystemColor#controlShadow
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    public final static int CONTROL_SHADOW = 21;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * {@link #controlDkShadow} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @see SystemColor#controlDkShadow
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    public final static int CONTROL_DK_SHADOW = 22;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * {@link #scrollbar} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @see SystemColor#scrollbar
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    public final static int SCROLLBAR = 23;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * {@link #info} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * @see SystemColor#info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    public final static int INFO = 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * The array index for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * {@link #infoText} system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @see SystemColor#infoText
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    public final static int INFO_TEXT = 25;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * The number of system colors in the array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    public final static int NUM_COLORS = 26;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    /******************************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * System colors with default initial values, overwritten by toolkit if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * system values differ and are available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * Should put array initialization above first field that is using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * SystemColor constructor to initialize.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    private static int[] systemColors = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        0xFF005C5C,  // desktop = new Color(0,92,92);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        0xFF000080,  // activeCaption = new Color(0,0,128);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        0xFFFFFFFF,  // activeCaptionText = Color.white;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        0xFFC0C0C0,  // activeCaptionBorder = Color.lightGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        0xFF808080,  // inactiveCaption = Color.gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        0xFFC0C0C0,  // inactiveCaptionText = Color.lightGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        0xFFC0C0C0,  // inactiveCaptionBorder = Color.lightGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        0xFFFFFFFF,  // window = Color.white;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        0xFF000000,  // windowBorder = Color.black;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        0xFF000000,  // windowText = Color.black;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        0xFFC0C0C0,  // menu = Color.lightGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        0xFF000000,  // menuText = Color.black;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        0xFFC0C0C0,  // text = Color.lightGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        0xFF000000,  // textText = Color.black;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        0xFF000080,  // textHighlight = new Color(0,0,128);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        0xFFFFFFFF,  // textHighlightText = Color.white;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        0xFF808080,  // textInactiveText = Color.gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        0xFFC0C0C0,  // control = Color.lightGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        0xFF000000,  // controlText = Color.black;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        0xFFFFFFFF,  // controlHighlight = Color.white;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        0xFFE0E0E0,  // controlLtHighlight = new Color(224,224,224);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        0xFF808080,  // controlShadow = Color.gray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        0xFF000000,  // controlDkShadow = Color.black;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        0xFFE0E0E0,  // scrollbar = new Color(224,224,224);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        0xFFE0E000,  // info = new Color(224,224,0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        0xFF000000,  // infoText = Color.black;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * The color rendered for the background of the desktop.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    public final static SystemColor desktop = new SystemColor((byte)DESKTOP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * The color rendered for the window-title background of the currently active window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    public final static SystemColor activeCaption = new SystemColor((byte)ACTIVE_CAPTION);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * The color rendered for the window-title text of the currently active window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    public final static SystemColor activeCaptionText = new SystemColor((byte)ACTIVE_CAPTION_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * The color rendered for the border around the currently active window.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    public final static SystemColor activeCaptionBorder = new SystemColor((byte)ACTIVE_CAPTION_BORDER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * The color rendered for the window-title background of inactive windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    public final static SystemColor inactiveCaption = new SystemColor((byte)INACTIVE_CAPTION);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * The color rendered for the window-title text of inactive windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    public final static SystemColor inactiveCaptionText = new SystemColor((byte)INACTIVE_CAPTION_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * The color rendered for the border around inactive windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    public final static SystemColor inactiveCaptionBorder = new SystemColor((byte)INACTIVE_CAPTION_BORDER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * The color rendered for the background of interior regions inside windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    public final static SystemColor window = new SystemColor((byte)WINDOW);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * The color rendered for the border around interior regions inside windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    public final static SystemColor windowBorder = new SystemColor((byte)WINDOW_BORDER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * The color rendered for text of interior regions inside windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public final static SystemColor windowText = new SystemColor((byte)WINDOW_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * The color rendered for the background of menus.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    public final static SystemColor menu = new SystemColor((byte)MENU);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * The color rendered for the text of menus.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    public final static SystemColor menuText = new SystemColor((byte)MENU_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * The color rendered for the background of text control objects, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * textfields and comboboxes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    public final static SystemColor text = new SystemColor((byte)TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * The color rendered for the text of text control objects, such as textfields
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * and comboboxes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    public final static SystemColor textText = new SystemColor((byte)TEXT_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * The color rendered for the background of selected items, such as in menus,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * comboboxes, and text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    public final static SystemColor textHighlight = new SystemColor((byte)TEXT_HIGHLIGHT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * The color rendered for the text of selected items, such as in menus, comboboxes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * and text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    public final static SystemColor textHighlightText = new SystemColor((byte)TEXT_HIGHLIGHT_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * The color rendered for the text of inactive items, such as in menus.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    public final static SystemColor textInactiveText = new SystemColor((byte)TEXT_INACTIVE_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * The color rendered for the background of control panels and control objects,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * such as pushbuttons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    public final static SystemColor control = new SystemColor((byte)CONTROL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * The color rendered for the text of control panels and control objects,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * such as pushbuttons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    public final static SystemColor controlText = new SystemColor((byte)CONTROL_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * The color rendered for light areas of 3D control objects, such as pushbuttons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * This color is typically derived from the <code>control</code> background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * to provide a 3D effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    public final static SystemColor controlHighlight = new SystemColor((byte)CONTROL_HIGHLIGHT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * The color rendered for highlight areas of 3D control objects, such as pushbuttons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * This color is typically derived from the <code>control</code> background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * to provide a 3D effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    public final static SystemColor controlLtHighlight = new SystemColor((byte)CONTROL_LT_HIGHLIGHT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * The color rendered for shadow areas of 3D control objects, such as pushbuttons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * This color is typically derived from the <code>control</code> background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * to provide a 3D effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    public final static SystemColor controlShadow = new SystemColor((byte)CONTROL_SHADOW);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * The color rendered for dark shadow areas on 3D control objects, such as pushbuttons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * This color is typically derived from the <code>control</code> background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * to provide a 3D effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    public final static SystemColor controlDkShadow = new SystemColor((byte)CONTROL_DK_SHADOW);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * The color rendered for the background of scrollbars.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    public final static SystemColor scrollbar = new SystemColor((byte)SCROLLBAR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * The color rendered for the background of tooltips or spot help.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    public final static SystemColor info = new SystemColor((byte)INFO);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * The color rendered for the text of tooltips or spot help.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    public final static SystemColor infoText = new SystemColor((byte)INFO_TEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * JDK 1.1 serialVersionUID.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    private static final long serialVersionUID = 4503142729533789064L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * An index into either array of SystemColor objects or values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    private transient int index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    private static SystemColor systemColorObjects [] = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        SystemColor.desktop,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        SystemColor.activeCaption,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        SystemColor.activeCaptionText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        SystemColor.activeCaptionBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        SystemColor.inactiveCaption,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        SystemColor.inactiveCaptionText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        SystemColor.inactiveCaptionBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        SystemColor.window,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        SystemColor.windowBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        SystemColor.windowText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        SystemColor.menu,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        SystemColor.menuText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        SystemColor.text,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        SystemColor.textText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        SystemColor.textHighlight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        SystemColor.textHighlightText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        SystemColor.textInactiveText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        SystemColor.control,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        SystemColor.controlText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        SystemColor.controlHighlight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        SystemColor.controlLtHighlight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        SystemColor.controlShadow,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
        SystemColor.controlDkShadow,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        SystemColor.scrollbar,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        SystemColor.info,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        SystemColor.infoText
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
      updateSystemColors();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * Called from <init> & toolkit to update the above systemColors cache.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    private static void updateSystemColors() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        if (!GraphicsEnvironment.isHeadless()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
            Toolkit.getDefaultToolkit().loadSystemColors(systemColors);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        for (int i = 0; i < systemColors.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
            systemColorObjects[i].value = systemColors[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * Creates a symbolic color that represents an indexed entry into system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * color cache. Used by above static system colors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    private SystemColor(byte index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        super(systemColors[index]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        this.index = index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * Returns a string representation of this <code>Color</code>'s values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * This method is intended to be used only for debugging purposes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     * and the content and format of the returned string may vary between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     * implementations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * The returned string may be empty but may not be <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * @return  a string representation of this <code>Color</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        return getClass().getName() + "[i=" + (index) + "]";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     * The design of the {@code SystemColor} class assumes that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     * the {@code SystemColor} object instances stored in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * static final fields above are the only instances that can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * be used by developers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     * This method helps maintain those limits on instantiation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     * by using the index stored in the value field of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     * serialized form of the object to replace the serialized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * object with the equivalent static object constant field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * of {@code SystemColor}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * See the {@link #writeReplace} method for more information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * on the serialized form of these objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * @return one of the {@code SystemColor} static object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     *         fields that refers to the same system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
    private Object readResolve() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        // The instances of SystemColor are tightly controlled and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        // only the canonical instances appearing above as static
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        // constants are allowed.  The serial form of SystemColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
        // objects stores the color index as the value.  Here we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        // map that index back into the canonical instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
        return systemColorObjects[value];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     * Returns a specialized version of the {@code SystemColor}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * object for writing to the serialized stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     * @serialData
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     * The value field of a serialized {@code SystemColor} object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
     * contains the array index of the system color instead of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     * rgb data for the system color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * This index is used by the {@link #readResolve} method to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     * resolve the deserialized objects back to the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * static constant versions to ensure unique instances of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * each {@code SystemColor} object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * @return a proxy {@code SystemColor} object with its value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     *         replaced by the corresponding system color index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    private Object writeReplace() throws ObjectStreamException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
        // we put an array index in the SystemColor.value while serialize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        // to keep compatibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
        SystemColor color = new SystemColor((byte)index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
        color.value = index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        return color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
}