Lines 18-136
Link Here
|
18 |
import javax.swing.plaf.*; |
18 |
import javax.swing.plaf.*; |
19 |
import javax.swing.plaf.metal.*; |
19 |
import javax.swing.plaf.metal.*; |
20 |
import org.openide.*; |
20 |
import org.openide.*; |
|
|
21 |
import java.util.*; |
22 |
/** An extension of javax.swing.plaf.metal.DefaultMetalTheme which can read a an xml |
23 |
* file named <code>themes.xml</code> and apply the theme defined in XML. NbTheme |
24 |
* stores its data in the <code>UIDefaults</code> instance available from the |
25 |
* look-and-feel manager (<code>UiManager.getLookAndFeel.getDefaults()</code>). |
26 |
* These means that theme files may also override per-component-type settings |
27 |
* stored there, so changes to look and feel deeper than those afforded by the |
28 |
* <code>MetalTheme</code> parent class are possible. |
29 |
* <P> |
30 |
* <code>NbTheme</code> supports five kinds of data: Colors, Fonts, Integers, |
31 |
* Strings, and Booleans, which are the major interesting data types typical |
32 |
* stored in <code>UIDefaults</code>. */ |
21 |
public class NbTheme extends MetalTheme implements org.xml.sax.DocumentHandler { |
33 |
public class NbTheme extends MetalTheme implements org.xml.sax.DocumentHandler { |
22 |
|
34 |
|
23 |
public static final String THEMEFILE_NAME = "Themes.xml"; // NOI18N |
35 |
public static final String THEMEFILE_NAME = "themes.xml"; // NOI18N |
24 |
|
36 |
// legal xml tags for theme files |
25 |
private static final String MAIN_TAG = "MetalTheme"; // NOI18N |
37 |
private static final String THEMESET_TAG = "themeset"; // NOI18N |
26 |
private static final String MAIN_ACTIVATE_TAG = "activate"; // NOI18N |
38 |
private static final String ACTIVE_ATTR = "active"; // NOI18N |
27 |
private static final String THEME_TAG = "Theme"; // NOI18N |
39 |
private static final String THEME_TAG = "theme"; // NOI18N |
28 |
private static final String THEME_NAME_TAG = "name"; // NOI18N |
40 |
private static final String BOOL_TAG = "boolean"; // NOI18N |
29 |
|
41 |
private static final String DIM_TAG = "dimension"; // NOI18N |
30 |
private static final String R_TAG = "R"; // NOI18N |
42 |
private static final String FONT_TAG = "font"; // NOI18N |
31 |
private static final String G_TAG = "G"; // NOI18N |
43 |
// attributes recognized in various tags |
32 |
private static final String B_TAG = "B"; // NOI18N |
44 |
private static final String COLOR_ATTR = "color"; // NOI18N |
33 |
private static final String PRIMARY1_TAG = "primary1"; // NOI18N |
45 |
private static final String KEY_ATTR = "key"; // NOI18N |
34 |
private static final String PRIMARY2_TAG = "primary2"; // NOI18N |
46 |
private static final String METRIC_ATTR = "metric"; // NOI18N |
35 |
private static final String PRIMARY3_TAG = "primary3"; // NOI18N |
47 |
private static final String STRING_ATTR = "string"; // NOI18N |
36 |
private static final String SECONDARY1_TAG = "secondary1"; // NOI18N |
48 |
private static final String NAME_ATTR = "name"; // NOI18N |
37 |
private static final String SECONDARY2_TAG = "secondary2"; // NOI18N |
49 |
private static final String FONTSTYLE_ATTR = "style"; // NOI18N |
38 |
private static final String SECONDARY3_TAG = "secondary3"; // NOI18N |
50 |
private static final String FONTSIZE_ATTR = "size"; // NOI18N |
39 |
|
51 |
private static final String VALUE_ATTR = "value"; |
40 |
private static final String FONTNAME_TAG = "name"; // NOI18N |
52 |
private static final String WIDTH_ATTR = "width"; |
41 |
private static final String FONTSTYLE_TAG = "style"; // NOI18N |
53 |
private static final String HEIGHT_ATTR = "height"; |
42 |
private static final String FONTSTYLE_PLAIN = "Plain"; // NOI18N |
54 |
private static final String RED_ATTR = "r"; // NOI18N |
43 |
private static final String FONTSTYLE_BOLD = "Bold"; // NOI18N |
55 |
private static final String GREEN_ATTR = "g"; // NOI18N |
44 |
private static final String FONTSTYLE_ITALIC = "Italic"; // NOI18N |
56 |
private static final String BLUE_ATTR = "b"; // NOI18N |
45 |
private static final String FONTSIZE_TAG = "size"; // NOI18N |
57 |
// font styles |
46 |
private static final String CONTROLFONT_TAG = "controlFont"; // NOI18N |
58 |
private static final String FONTSTYLE_PLAIN = "plain"; // NOI18N |
47 |
private static final String SYSTEMFONT_TAG = "systemFont"; // NOI18N |
59 |
private static final String FONTSTYLE_BOLD = "bold"; // NOI18N |
48 |
private static final String USERFONT_TAG = "userFont"; // NOI18N |
60 |
private static final String FONTSTYLE_ITALIC = "italic"; // NOI18N |
49 |
private static final String SUBFONT_TAG = "subFont"; // NOI18N |
61 |
// keys used to store theme values in UIDefaults |
50 |
private static final String MENUFONT_TAG = "menuFont"; // NOI18N |
62 |
private static final String CONTROLFONT = "controlFont"; |
51 |
private static final String WINDOWTITLEFONT_TAG = "windowTitleFont"; // NOI18N |
63 |
private static final String SYSTEMFONT = "systemFont"; |
52 |
|
64 |
private static final String USERFONT = "userFont"; |
53 |
|
65 |
private static final String MENUFONT = "menuFont"; |
54 |
// default Theme |
66 |
private static final String WINDOWTITLEFONT = "windowTitleFont"; |
55 |
private ColorUIResource primary1 = new ColorUIResource(102, 102, 153); |
67 |
private static final String SUBFONT = "subFont"; |
56 |
private ColorUIResource primary2 = new ColorUIResource(153, 153, 204); |
68 |
private static final String PRIMARY1 = "primary1"; |
57 |
private ColorUIResource primary3 = new ColorUIResource(204, 204, 255); |
69 |
private static final String PRIMARY2 = "primary2"; |
58 |
|
70 |
private static final String PRIMARY3 = "primary3"; |
59 |
private ColorUIResource secondary1 = new ColorUIResource(102, 102, 102); |
71 |
private static final String SECONDARY1 = "secondary1"; |
60 |
private ColorUIResource secondary2 = new ColorUIResource(153, 153, 153); |
72 |
private static final String SECONDARY2 = "secondary2"; |
61 |
private ColorUIResource secondary3 = new ColorUIResource(204, 204, 204); |
73 |
private static final String SECONDARY3 = "secondary3"; |
62 |
|
74 |
private static final String WHITE = "white"; |
63 |
private FontUIResource controlFont; |
75 |
private static final String BLACK = "black"; |
64 |
private FontUIResource systemFont; |
76 |
|
65 |
private FontUIResource userFont; |
77 |
private HashSet activeThemes=null; |
66 |
private FontUIResource subFont; |
78 |
private boolean inActiveTheme=false; |
67 |
private FontUIResource menuFont; |
79 |
|
68 |
private FontUIResource windowTitleFont; |
80 |
private UIDefaults defaults; |
69 |
|
81 |
public String getName(){ return "NetBeans XML Theme"; } // NOI18N |
70 |
private String activeTag=""; // NOI18N |
82 |
/** Create a new instance of NBTheme */ |
71 |
private boolean activeTagFlag=false; |
|
|
72 |
|
73 |
public String getName(){ return "NetBeans"; } // NOI18N |
74 |
|
75 |
/** Creates new NBTheme */ |
76 |
public NbTheme() { |
83 |
public NbTheme() { |
77 |
try{ |
84 |
defaults = UIManager.getDefaults(); //cache to avoid overhead |
78 |
controlFont = new FontUIResource(new Font("Dialog", Font.PLAIN, 11)); // NOI18N |
85 |
addCustomDefaults (); |
79 |
systemFont = new FontUIResource(new Font("Dialog", Font.PLAIN, 11)); // NOI18N |
|
|
80 |
userFont = new FontUIResource(new Font("Dialog", Font.PLAIN, 11)); // NOI18N |
81 |
menuFont = new FontUIResource(new Font("Dialog", Font.PLAIN, 11)); // NOI18N |
82 |
windowTitleFont = new FontUIResource(new Font("Dialog", Font.PLAIN, 11)); // NOI18N |
83 |
subFont = new FontUIResource(new Font("Dialog", Font.PLAIN, 10)); // NOI18N |
84 |
UIManager.getDefaults ().put ("List.font", controlFont); // NOI18N |
85 |
UIManager.getDefaults ().put ("Tree.font", controlFont); // NOI18N |
86 |
UIManager.getDefaults ().put ("Panel.font", controlFont); // NOI18N |
87 |
} catch (Exception e){ |
88 |
ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, e); |
89 |
} |
90 |
parseTheme(); |
86 |
parseTheme(); |
91 |
} |
87 |
} |
92 |
|
88 |
|
93 |
protected ColorUIResource getPrimary1() { return primary1; } |
89 |
private void addCustomDefaults () { |
94 |
protected ColorUIResource getPrimary2() { return primary2; } |
90 |
//Note, all of this could be removed, and the themes file used |
95 |
protected ColorUIResource getPrimary3() { return primary3; } |
91 |
//for this job, but it does mean NetBeans would never start if |
96 |
|
92 |
//the themes file was missing - primary1, etc. would produce an NPE |
97 |
protected ColorUIResource getSecondary1() { return secondary1; } |
93 |
//when the UI calls them - Tim |
98 |
protected ColorUIResource getSecondary2() { return secondary2; } |
94 |
defaults.put(PRIMARY1, new ColorUIResource(102, 102, 153)); // NOI18N |
99 |
protected ColorUIResource getSecondary3() { return secondary3; } |
95 |
defaults.put(PRIMARY2, new ColorUIResource(153, 153, 204)); // NOI18N |
100 |
|
96 |
defaults.put(PRIMARY3, new ColorUIResource(204, 204, 255)); // NOI18N |
101 |
public FontUIResource getControlTextFont() { return controlFont; } |
97 |
|
102 |
public FontUIResource getSystemTextFont() { return systemFont; } |
98 |
defaults.put(SECONDARY1, new ColorUIResource(102, 102, 102)); // NOI18N |
103 |
public FontUIResource getUserTextFont() { return userFont; } |
99 |
defaults.put(SECONDARY2, new ColorUIResource(153, 153, 153)); // NOI18N |
104 |
public FontUIResource getMenuTextFont() { return menuFont; } |
100 |
defaults.put(SECONDARY3, new ColorUIResource(204, 204, 204)); // NOI18N |
105 |
public FontUIResource getWindowTitleFont() { return windowTitleFont; } |
101 |
|
106 |
public FontUIResource getSubTextFont() { return subFont; } |
102 |
defaults.put(WHITE, new ColorUIResource(255,255,255)); // NOI18N |
|
|
103 |
defaults.put(BLACK, new ColorUIResource(0,0,0)); // NOI18N |
104 |
|
105 |
FontUIResource controlFont = new FontUIResource(new Font("Dialog", Font.PLAIN, 11)); |
106 |
defaults.put(CONTROLFONT, controlFont); // NOI18N |
107 |
defaults.put(SYSTEMFONT, controlFont); // NOI18N |
108 |
defaults.put(USERFONT, controlFont); // NOI18N |
109 |
defaults.put(MENUFONT, controlFont); // NOI18N |
110 |
defaults.put(WINDOWTITLEFONT, controlFont); // NOI18N |
111 |
UIManager.getDefaults ().put ("List.font", controlFont); // NOI18N |
112 |
UIManager.getDefaults ().put ("Tree.font", controlFont); // NOI18N |
113 |
UIManager.getDefaults ().put ("Panel.font", controlFont); // NOI18N |
114 |
|
115 |
defaults.put(SUBFONT, new FontUIResource(new Font("Dialog", Font.PLAIN, 10))); // NOI18N |
116 |
} |
107 |
|
117 |
|
108 |
private void parseTheme(){ |
118 |
private void parseTheme(){ |
109 |
|
|
|
110 |
org.xml.sax.Parser p = org.openide.loaders.XMLDataObject.createParser(); |
119 |
org.xml.sax.Parser p = org.openide.loaders.XMLDataObject.createParser(); |
111 |
p.setDocumentHandler(this); |
120 |
p.setDocumentHandler(this); |
112 |
java.io.File f = new java.io.File(NonGui.getSystemDir() + java.io.File.separator + THEMEFILE_NAME); |
121 |
java.io.File f = new java.io.File(NonGui.getSystemDir() + java.io.File.separator + THEMEFILE_NAME); |
113 |
java.io.Reader cs = null; |
122 |
if (!f.exists()) { |
114 |
boolean useDefaults = false; |
123 |
return; |
115 |
try{ |
124 |
} |
116 |
cs = new java.io.FileReader(f); |
125 |
java.io.Reader fr = null; |
|
|
126 |
try { |
127 |
fr = new java.io.FileReader(f); |
117 |
} |
128 |
} |
118 |
catch(java.io.FileNotFoundException e){ |
129 |
catch(java.io.FileNotFoundException e){ |
119 |
useDefaults = true; |
130 |
//should never happen |
|
|
131 |
ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, e); |
120 |
} |
132 |
} |
121 |
|
133 |
|
122 |
if(!useDefaults){ |
134 |
org.xml.sax.InputSource is = new org.xml.sax.InputSource(fr); |
123 |
org.xml.sax.InputSource is = new org.xml.sax.InputSource(cs); |
135 |
try{ |
124 |
|
136 |
p.parse(is); |
125 |
try{ |
137 |
activeThemes=null; //dispose of now useless hashtable |
126 |
p.parse(is); |
138 |
} |
127 |
} |
139 |
catch(java.io.IOException ie){ |
128 |
catch(java.io.IOException ie){ |
140 |
ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ie); |
129 |
ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, ie); |
141 |
} |
130 |
} |
142 |
catch(org.xml.sax.SAXException se){ |
131 |
catch(org.xml.sax.SAXException se){ |
143 |
ErrorManager.getDefault().annotate(se, "Error parsing theme file"); //NOI18N |
132 |
ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, se); |
144 |
ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, se); |
133 |
} |
|
|
134 |
} |
145 |
} |
135 |
} |
146 |
} |
136 |
|
147 |
|
Lines 141-229
Link Here
|
141 |
} |
152 |
} |
142 |
|
153 |
|
143 |
public void startElement(java.lang.String p1,org.xml.sax.AttributeList atts) throws org.xml.sax.SAXException { |
154 |
public void startElement(java.lang.String p1,org.xml.sax.AttributeList atts) throws org.xml.sax.SAXException { |
144 |
int r = 0; |
155 |
//found the themeset? |
145 |
int g = 0; |
156 |
if (p1.equals(THEMESET_TAG)) { |
146 |
int b = 0; |
157 |
//break out the comma delimited list of active themes |
147 |
String fontname = null; |
158 |
//and stores them in activeThemes hashset |
148 |
int fontstyle = 0; |
159 |
String themes = atts.getValue (ACTIVE_ATTR); |
149 |
int fontsize = 0; |
160 |
if (themes != null) { |
150 |
|
161 |
StringTokenizer tok = new StringTokenizer (themes, ","); //NOI18N |
151 |
if(p1.equals(MAIN_TAG) && atts.getLength()==1 && atts.getName(0).equals(MAIN_ACTIVATE_TAG)) { |
162 |
activeThemes = new HashSet (tok.countTokens() + 1); |
152 |
activeTag = atts.getValue(0); |
163 |
while (tok.hasMoreTokens()) { |
|
|
164 |
activeThemes.add(tok.nextToken()); |
165 |
} |
166 |
} |
153 |
} |
167 |
} |
154 |
else{ |
168 |
else{ |
155 |
if(p1.equals(THEME_TAG) && atts.getLength()==1 && atts.getName(0).equals(THEME_NAME_TAG) && atts.getValue(0).equals(activeTag)){ |
169 |
if (p1.equals(THEME_TAG) && (activeThemes != null)) { |
156 |
activeTagFlag=true; |
170 |
//see if the current theme is one of the active ones |
157 |
} |
171 |
String themeName = atts.getValue (NAME_ATTR); |
158 |
|
172 |
inActiveTheme = activeThemes.contains(themeName); |
159 |
if(activeTagFlag){ |
173 |
} else { |
160 |
for (int i = 0; i < atts.getLength(); i++) { |
174 |
if (inActiveTheme) { |
161 |
if(atts.getName(i).equals(R_TAG)){ |
175 |
if (p1.equals (COLOR_ATTR)) { |
162 |
r = Integer.valueOf(atts.getValue(i)).intValue(); |
176 |
handleColor (atts); |
163 |
} |
177 |
return; |
164 |
if(atts.getName(i).equals(G_TAG)){ |
|
|
165 |
g = Integer.valueOf(atts.getValue(i)).intValue(); |
166 |
} |
167 |
if(atts.getName(i).equals(B_TAG)){ |
168 |
b = Integer.valueOf(atts.getValue(i)).intValue(); |
169 |
} |
170 |
if(atts.getName(i).equals(FONTNAME_TAG)){ |
171 |
fontname = atts.getValue(i); |
172 |
} |
173 |
if(atts.getName(i).equals(FONTSTYLE_TAG)){ |
174 |
if(atts.getValue(i).equals(FONTSTYLE_PLAIN)) fontstyle = Font.PLAIN; |
175 |
if(atts.getValue(i).equals(FONTSTYLE_BOLD)) fontstyle = Font.BOLD; |
176 |
if(atts.getValue(i).equals(FONTSTYLE_ITALIC)) fontstyle = Font.ITALIC; |
177 |
} |
178 |
} |
178 |
if(atts.getName(i).equals(FONTSIZE_TAG)){ |
179 |
if (p1.equals (FONT_TAG)) { |
179 |
fontsize = Integer.valueOf(atts.getValue(i)).intValue(); |
180 |
handleFont (atts); |
|
|
181 |
return; |
182 |
} |
183 |
if (p1.equals (METRIC_ATTR)) { |
184 |
handleMetric (atts); |
185 |
return; |
186 |
} |
187 |
if (p1.equals (STRING_ATTR)) { |
188 |
handleString (atts); |
189 |
return; |
190 |
} |
191 |
if (p1.equals (BOOL_TAG)) { |
192 |
handleBool (atts); |
193 |
return; |
194 |
} |
195 |
if (p1.equals (DIM_TAG)) { |
196 |
handleDim (atts); |
180 |
} |
197 |
} |
181 |
} |
|
|
182 |
|
183 |
if(p1.equals(PRIMARY1_TAG)){ |
184 |
primary1 = new ColorUIResource(r, g, b); |
185 |
} |
186 |
if(p1.equals(PRIMARY2_TAG)){ |
187 |
primary2 = new ColorUIResource(r, g, b); |
188 |
} |
189 |
if(p1.equals(PRIMARY3_TAG)){ |
190 |
primary3 = new ColorUIResource(r, g, b); |
191 |
} |
192 |
|
193 |
if(p1.equals(SECONDARY1_TAG)){ |
194 |
secondary1 = new ColorUIResource(r, g, b); |
195 |
} |
196 |
if(p1.equals(SECONDARY2_TAG)){ |
197 |
secondary2 = new ColorUIResource(r, g, b); |
198 |
} |
199 |
if(p1.equals(SECONDARY3_TAG)){ |
200 |
secondary3 = new ColorUIResource(r, g, b); |
201 |
} |
202 |
if(p1.equals(CONTROLFONT_TAG)){ |
203 |
controlFont = new FontUIResource(new Font(fontname, fontstyle, fontsize)); |
204 |
UIManager.getDefaults ().put ("List.font", controlFont); // NOI18N |
205 |
UIManager.getDefaults ().put ("Tree.font", controlFont); // NOI18N |
206 |
UIManager.getDefaults ().put ("Panel.font", controlFont); // NOI18N |
207 |
} |
208 |
if(p1.equals(SYSTEMFONT_TAG)){ |
209 |
systemFont = new FontUIResource(new Font(fontname, fontstyle, fontsize)); |
210 |
} |
211 |
if(p1.equals(USERFONT_TAG)){ |
212 |
userFont = new FontUIResource(new Font(fontname, fontstyle, fontsize)); |
213 |
} |
214 |
if(p1.equals(SUBFONT_TAG)){ |
215 |
subFont = new FontUIResource(new Font(fontname, fontstyle, fontsize)); |
216 |
} |
217 |
if(p1.equals(MENUFONT_TAG)){ |
218 |
menuFont = new FontUIResource(new Font(fontname, fontstyle, fontsize)); |
219 |
} |
220 |
if(p1.equals(WINDOWTITLEFONT_TAG)){ |
221 |
windowTitleFont = new FontUIResource(new Font(fontname, fontstyle, fontsize)); |
222 |
} |
198 |
} |
223 |
} |
199 |
} |
224 |
} |
200 |
} |
225 |
} |
201 |
} |
226 |
|
202 |
|
|
|
203 |
private final void handleFont (org.xml.sax.AttributeList atts) { |
204 |
String key = atts.getValue (KEY_ATTR); |
205 |
String fontname = atts.getValue (NAME_ATTR); |
206 |
String fontstylename = atts.getValue (FONTSTYLE_ATTR); |
207 |
int fontsize = intFromAttr (atts, FONTSIZE_ATTR); |
208 |
int fontstyle = Font.PLAIN; |
209 |
if(fontstylename.equals(FONTSTYLE_BOLD)) { |
210 |
fontstyle = Font.BOLD; |
211 |
} else { |
212 |
if(fontstylename.equals(FONTSTYLE_ITALIC)) fontstyle = Font.ITALIC; |
213 |
} |
214 |
FontUIResource resource = new FontUIResource (fontname, fontstyle, fontsize); |
215 |
defaults.put (key, resource); |
216 |
} |
217 |
|
218 |
private final void handleColor (org.xml.sax.AttributeList atts) { |
219 |
int r = intFromAttr (atts, RED_ATTR); |
220 |
int g = intFromAttr (atts, GREEN_ATTR); |
221 |
int b = intFromAttr (atts, BLUE_ATTR); |
222 |
String key = atts.getValue(KEY_ATTR); |
223 |
ColorUIResource resource = new ColorUIResource (r,g,b); |
224 |
defaults.put (key, resource); |
225 |
} |
226 |
|
227 |
private final void handleMetric (org.xml.sax.AttributeList atts) { |
228 |
String key = atts.getValue(KEY_ATTR); |
229 |
Integer resource = Integer.valueOf (atts.getValue(VALUE_ATTR)); |
230 |
defaults.put (key, resource); |
231 |
} |
232 |
|
233 |
private final void handleString (org.xml.sax.AttributeList atts) { |
234 |
String key = atts.getValue (KEY_ATTR); |
235 |
String resource = atts.getValue (VALUE_ATTR); |
236 |
defaults.put (key, resource); |
237 |
} |
238 |
|
239 |
private final void handleBool (org.xml.sax.AttributeList atts) { |
240 |
String key = atts.getValue (KEY_ATTR); |
241 |
Boolean resource = Boolean.valueOf (key); |
242 |
defaults.put (key, resource); |
243 |
} |
244 |
|
245 |
private final void handleDim (org.xml.sax.AttributeList atts) { |
246 |
String key = atts.getValue (KEY_ATTR); |
247 |
int width = intFromAttr (atts, WIDTH_ATTR); |
248 |
int height = intFromAttr (atts, HEIGHT_ATTR); |
249 |
DimensionUIResource resource = new DimensionUIResource (width, height); |
250 |
defaults.put (key, resource); |
251 |
} |
252 |
|
253 |
private final int intFromAttr (final org.xml.sax.AttributeList atts, final String key) { |
254 |
try { |
255 |
return Integer.valueOf (atts.getValue (key)).intValue(); |
256 |
} catch (NumberFormatException nfe) { |
257 |
ErrorManager.getDefault().notify(org.openide.ErrorManager.INFORMATIONAL, nfe); |
258 |
return 0; |
259 |
} |
260 |
} |
261 |
|
227 |
public void characters(char[] p1,int p2,int p3) throws org.xml.sax.SAXException { |
262 |
public void characters(char[] p1,int p2,int p3) throws org.xml.sax.SAXException { |
228 |
} |
263 |
} |
229 |
|
264 |
|
Lines 232-240
Link Here
|
232 |
|
267 |
|
233 |
public void endElement(java.lang.String p1) throws org.xml.sax.SAXException { |
268 |
public void endElement(java.lang.String p1) throws org.xml.sax.SAXException { |
234 |
if(p1.equals(THEME_TAG)){ |
269 |
if(p1.equals(THEME_TAG)){ |
235 |
activeTagFlag=false; |
270 |
inActiveTheme=false; |
236 |
} |
271 |
} |
237 |
|
|
|
238 |
} |
272 |
} |
239 |
|
273 |
|
240 |
public void ignorableWhitespace(char[] p1,int p2,int p3) throws org.xml.sax.SAXException { |
274 |
public void ignorableWhitespace(char[] p1,int p2,int p3) throws org.xml.sax.SAXException { |
Lines 242-255
Link Here
|
242 |
|
276 |
|
243 |
public void processingInstruction(java.lang.String p1,java.lang.String p2) throws org.xml.sax.SAXException { |
277 |
public void processingInstruction(java.lang.String p1,java.lang.String p2) throws org.xml.sax.SAXException { |
244 |
} |
278 |
} |
|
|
279 |
|
280 |
private final ColorUIResource getColor(String key) { |
281 |
return (ColorUIResource) defaults.get (key); |
282 |
} |
283 |
|
284 |
private final FontUIResource getFont(String key) { |
285 |
return (FontUIResource) defaults.get (key); |
286 |
} |
287 |
|
288 |
public FontUIResource getControlTextFont() { return getFont (CONTROLFONT); } |
289 |
public FontUIResource getSystemTextFont() { return getFont (SYSTEMFONT); } |
290 |
public FontUIResource getUserTextFont() { return getFont (USERFONT); } |
291 |
public FontUIResource getMenuTextFont() { return getFont (MENUFONT); } |
292 |
public FontUIResource getWindowTitleFont() { return getFont (WINDOWTITLEFONT); } |
293 |
public FontUIResource getSubTextFont() { return getFont (SUBFONT); } |
294 |
protected ColorUIResource getPrimary1() { return getColor (PRIMARY1); } |
295 |
protected ColorUIResource getPrimary2() { return getColor (PRIMARY2); } |
296 |
protected ColorUIResource getPrimary3() { return getColor (PRIMARY3); } |
297 |
protected ColorUIResource getSecondary1() { return getColor (SECONDARY1); } |
298 |
protected ColorUIResource getSecondary2() { return getColor (SECONDARY2); } |
299 |
protected ColorUIResource getSecondary3() { return getColor (SECONDARY3); } |
300 |
protected ColorUIResource getWhite() { return getColor (WHITE); } |
301 |
protected ColorUIResource getBlack() { return getColor (BLACK); } |
245 |
|
302 |
|
246 |
/* |
|
|
247 |
public ColorUIResource getSystemTextColor(){ return primary1; } |
248 |
public ColorUIResource getControlTextColor(){ return primary1; } |
249 |
public ColorUIResource getInactiveControlTextColor(){ return primary1; } |
250 |
public ColorUIResource getInactiveSystemTextColor(){ return primary1; } |
251 |
public ColorUIResource getUserTextColor(){ return primary1; } |
252 |
public ColorUIResource getTextHighlightColor(){ return primary1; } |
253 |
public ColorUIResource getHighlightedTextColor(){ return primary1; } |
254 |
*/ |
255 |
} |
303 |
} |