KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwt > awt > SystemColor


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: SystemColor.java,v $
11    Revision 1.3 2004/03/26 10:43:48 bobintetley
12    Proper SystemColor implementation returns real colours
13
14    Revision 1.2 2004/03/23 15:22:06 bobintetley
15    SystemColor/Dialog fix and SwingWTUtils.setEclipsePlugin(true) implementation
16
17    Revision 1.1 2004/03/23 09:58:56 bobintetley
18    SystemColor and FileDialog implementation, plus JOptionPane.showOptionDialog support
19
20
21 */

22
23 package swingwt.awt;
24
25 import org.eclipse.swt.SWT;
26 import swingwtx.swing.SwingWTUtils;
27
28 /**
29  * System Color mapped implementation to
30  * values read from SWT
31  *
32  * @author Robin Rawson-Tetley
33  */

34 public final class SystemColor extends Color {
35
36     private static SystemColor[] systemColors = {
37         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)),
38         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND)),
39         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_FOREGROUND)),
40         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT)),
41         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND)),
42         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)),
43         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)),
44         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)),
45         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BORDER)),
46         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)),
47         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)),
48         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)),
49         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)),
50         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)),
51         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND)),
52         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_FOREGROUND)),
53         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)),
54         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)),
55         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)),
56         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND)),
57         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT)),
58         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)),
59         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)),
60         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND)),
61         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)),
62         new SystemColor(SwingWTUtils.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)),
63     };
64
65     public final static int DESKTOP = 0;
66     public final static int ACTIVE_CAPTION = 1;
67     public final static int ACTIVE_CAPTION_TEXT = 2;
68     public final static int ACTIVE_CAPTION_BORDER = 3;
69     public final static int INACTIVE_CAPTION = 4;
70     public final static int INACTIVE_CAPTION_TEXT = 5;
71     public final static int INACTIVE_CAPTION_BORDER = 6;
72     public final static int WINDOW = 7;
73     public final static int WINDOW_BORDER = 8;
74     public final static int WINDOW_TEXT = 9;
75     public final static int MENU = 10;
76     public final static int MENU_TEXT = 11;
77     public final static int TEXT = 12;
78     public final static int TEXT_TEXT = 13;
79     public final static int TEXT_HIGHLIGHT = 14;
80     public final static int TEXT_HIGHLIGHT_TEXT = 15;
81     public final static int TEXT_INACTIVE_TEXT = 16;
82     public final static int CONTROL = 17;
83     public final static int CONTROL_TEXT = 18;
84     public final static int CONTROL_HIGHLIGHT = 19;
85     public final static int CONTROL_LT_HIGHLIGHT = 20;
86     public final static int CONTROL_SHADOW = 21;
87     public final static int CONTROL_DK_SHADOW = 22;
88     public final static int SCROLLBAR = 23;
89     public final static int INFO = 24;
90     public final static int INFO_TEXT = 25;
91     public final static int NUM_COLORS = 26;
92
93     public final static SystemColor desktop = systemColors[DESKTOP];
94     public final static SystemColor activeCaption = systemColors[ACTIVE_CAPTION];
95     public final static SystemColor activeCaptionText = systemColors[ACTIVE_CAPTION_TEXT];
96     public final static SystemColor activeCaptionBorder = systemColors[ACTIVE_CAPTION_BORDER];
97     public final static SystemColor inactiveCaption = systemColors[INACTIVE_CAPTION];
98     public final static SystemColor inactiveCaptionText = systemColors[INACTIVE_CAPTION_TEXT];
99     public final static SystemColor inactiveCaptionBorder = systemColors[INACTIVE_CAPTION_BORDER];
100     public final static SystemColor window = systemColors[WINDOW];
101     public final static SystemColor windowBorder = systemColors[WINDOW_BORDER];
102     public final static SystemColor windowText = systemColors[WINDOW_TEXT];
103     public final static SystemColor menu = systemColors[MENU];
104     public final static SystemColor menuText = systemColors[MENU_TEXT];
105     public final static SystemColor text = systemColors[TEXT];
106     public final static SystemColor textText = systemColors[TEXT_TEXT];
107     public final static SystemColor textHighlight = systemColors[TEXT_HIGHLIGHT];
108     public final static SystemColor textHighlightText = systemColors[TEXT_HIGHLIGHT_TEXT];
109     public final static SystemColor textInactiveText = systemColors[TEXT_INACTIVE_TEXT];
110     public final static SystemColor control = systemColors[CONTROL];
111     public final static SystemColor controlText = systemColors[CONTROL_TEXT];
112     public final static SystemColor controlHighlight = systemColors[CONTROL_HIGHLIGHT];
113     public final static SystemColor controlLtHighlight = systemColors[CONTROL_LT_HIGHLIGHT];
114     public final static SystemColor controlShadow = systemColors[CONTROL_SHADOW];
115     public final static SystemColor controlDkShadow = systemColors[CONTROL_DK_SHADOW];
116     public final static SystemColor scrollbar = systemColors[SCROLLBAR];
117     public final static SystemColor info = systemColors[INFO];
118     public final static SystemColor infoText = systemColors[INFO_TEXT];
119
120     public SystemColor(org.eclipse.swt.graphics.Color swtColour) {
121         super(swtColour);
122     }
123     
124 }
125
Popular Tags