001: //** Copyright Statement ***************************************************
002: //The Salmon Open Framework for Internet Applications (SOFIA)
003: //Copyright (C) 1999 - 2002, Salmon LLC
004: //
005: //This program is free software; you can redistribute it and/or
006: //modify it under the terms of the GNU General Public License version 2
007: //as published by the Free Software Foundation;
008: //
009: //This program is distributed in the hope that it will be useful,
010: //but WITHOUT ANY WARRANTY; without even the implied warranty of
011: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: //GNU General Public License for more details.
013: //
014: //You should have received a copy of the GNU General Public License
015: //along with this program; if not, write to the Free Software
016: //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: //
018: //For more information please visit http://www.salmonllc.com
019: //** End Copyright Statement ***************************************************
020: package com.salmonllc.personalization;
021:
022: import javax.swing.plaf.metal.DefaultMetalTheme;
023: import javax.swing.plaf.ColorUIResource;
024: import javax.swing.plaf.FontUIResource;
025:
026: /**
027: * An implementation of a Swing Metal Theme object. The object has set methods for each Swing attribute so colors and fonts can be set at run time.
028: */
029: public class SMetalTheme extends DefaultMetalTheme {
030: private ColorUIResource _acceleratorForeground;
031: private ColorUIResource _acceleratorSelectedForeground;
032: private ColorUIResource _black;
033: private ColorUIResource _control;
034: private ColorUIResource _controlDarkShadow;
035: private ColorUIResource _controlDisabled;
036: private ColorUIResource _controlHighlight;
037: private ColorUIResource _controlInfo;
038: private ColorUIResource _controlShadow;
039: private ColorUIResource _controlTextColor;
040: private FontUIResource _controlTextFont;
041: private ColorUIResource _desktopColor;
042: private ColorUIResource _focusColor;
043: private ColorUIResource _highlightedTextColor;
044: private ColorUIResource _inactiveTextColor;
045: private ColorUIResource _inactiveSystemTextColor;
046: private ColorUIResource _menuBackground;
047: private ColorUIResource _menuDisabledForeground;
048: private ColorUIResource _menuForeground;
049: private ColorUIResource _menuSelectedBackground;
050: private ColorUIResource _menuSelectedForeground;
051: private FontUIResource _menuTextFont;
052: private ColorUIResource _primary1;
053: private ColorUIResource _primary2;
054: private ColorUIResource _primary3;
055: private ColorUIResource _primaryControl;
056: private ColorUIResource _primaryControlDarkShadow;
057: private ColorUIResource _primaryControlHighlight;
058: private ColorUIResource _primaryControlInfo;
059: private ColorUIResource _primaryControlShadow;
060: private ColorUIResource _secondary1;
061: private ColorUIResource _secondary2;
062: private ColorUIResource _secondary3;
063: private ColorUIResource _separatorBackground;
064: private ColorUIResource _separatorForeground;
065: private FontUIResource _subTextFont;
066: private ColorUIResource _systemTextColor;
067: private FontUIResource _systemTextFont;
068: private ColorUIResource _textHighlightColor;
069: private ColorUIResource _userTextColor;
070: private FontUIResource _userTextFont;
071: private ColorUIResource _white;
072: private ColorUIResource _windowBackground;
073: private ColorUIResource _windowTitleBackground;
074: private FontUIResource _windowTitleFont;
075: private ColorUIResource _windowTitleForeground;
076: private ColorUIResource _windowInactiveBackground;
077: private ColorUIResource _windowTitleInactiveForeground;
078:
079: public ColorUIResource getAcceleratorForeground() {
080: if (_acceleratorForeground != null)
081: return _acceleratorForeground;
082: return super .getAcceleratorForeground();
083: }
084:
085: public ColorUIResource getAcceleratorSelectedForeground() {
086: if (_acceleratorSelectedForeground != null)
087: return _acceleratorSelectedForeground;
088: return super .getAcceleratorSelectedForeground();
089: }
090:
091: protected ColorUIResource getBlack() {
092: if (_black != null)
093: return _black;
094: return super .getBlack();
095: }
096:
097: public ColorUIResource getControl() {
098: if (_control != null)
099: return _control;
100: return super .getControl();
101: }
102:
103: public ColorUIResource getControlDarkShadow() {
104: if (_controlDarkShadow != null)
105: return _controlDarkShadow;
106: return super .getControlDarkShadow();
107: }
108:
109: public ColorUIResource getControlDisabled() {
110: if (_controlDisabled != null)
111: return _controlDisabled;
112:
113: return super .getControlDisabled();
114: }
115:
116: public ColorUIResource getControlHighlight() {
117: if (_controlHighlight != null)
118: return _controlHighlight;
119: return super .getControlHighlight();
120: }
121:
122: public ColorUIResource getControlInfo() {
123: if (_controlInfo != null)
124: return _controlInfo;
125: return super .getControlInfo();
126: }
127:
128: public ColorUIResource getControlShadow() {
129: if (_controlShadow != null)
130: return _controlShadow;
131: return super .getControlShadow();
132: }
133:
134: public ColorUIResource getControlTextColor() {
135: if (_controlTextColor != null)
136: return _controlTextColor;
137: return super .getControlTextColor();
138: }
139:
140: public FontUIResource getControlTextFont() {
141: if (_controlTextFont != null)
142: return _controlTextFont;
143: return super .getControlTextFont();
144: }
145:
146: public ColorUIResource getDesktopColor() {
147: if (_desktopColor != null)
148: return _desktopColor;
149:
150: return super .getDesktopColor();
151: }
152:
153: public ColorUIResource getFocusColor() {
154: if (_focusColor != null)
155: return _focusColor;
156:
157: return super .getFocusColor();
158: }
159:
160: public ColorUIResource getHighlightedTextColor() {
161: if (_highlightedTextColor != null)
162: return _highlightedTextColor;
163:
164: return super .getHighlightedTextColor();
165: }
166:
167: public ColorUIResource getInactiveControlTextColor() {
168: if (_inactiveTextColor != null)
169: return _inactiveTextColor;
170:
171: return super .getInactiveControlTextColor();
172: }
173:
174: public ColorUIResource getInactiveSystemTextColor() {
175: if (_inactiveSystemTextColor != null)
176: return _inactiveSystemTextColor;
177:
178: return super .getInactiveSystemTextColor();
179: }
180:
181: public ColorUIResource getMenuBackground() {
182: if (_menuBackground != null)
183: return _menuBackground;
184:
185: return super .getMenuBackground();
186: }
187:
188: public ColorUIResource getMenuDisabledForeground() {
189: if (_menuDisabledForeground != null)
190: return _menuDisabledForeground;
191: return super .getMenuDisabledForeground();
192: }
193:
194: public ColorUIResource getMenuForeground() {
195: if (_menuForeground != null)
196: return _menuForeground;
197: return super .getMenuForeground();
198: }
199:
200: public ColorUIResource getMenuSelectedBackground() {
201: if (_menuSelectedBackground != null)
202: return _menuSelectedBackground;
203:
204: return super .getMenuSelectedBackground();
205: }
206:
207: public ColorUIResource getMenuSelectedForeground() {
208: if (_menuSelectedForeground != null)
209: return _menuSelectedForeground;
210:
211: return super .getMenuSelectedForeground();
212: }
213:
214: public FontUIResource getMenuTextFont() {
215: if (_menuTextFont != null)
216: return _menuTextFont;
217:
218: return super .getMenuTextFont();
219: }
220:
221: // these are blue in Metal Default Theme
222: protected ColorUIResource getPrimary1() {
223: if (_primary1 != null)
224: return _primary1;
225: return super .getPrimary1();
226: }
227:
228: protected ColorUIResource getPrimary2() {
229: if (_primary2 != null)
230: return _primary2;
231: return super .getPrimary2();
232: }
233:
234: protected ColorUIResource getPrimary3() {
235: if (_primary3 != null)
236: return _primary3;
237:
238: return super .getPrimary3();
239: }
240:
241: public ColorUIResource getPrimaryControl() {
242: if (_primaryControl != null)
243: return _primaryControl;
244:
245: return super .getPrimaryControl();
246: }
247:
248: public ColorUIResource getPrimaryControlDarkShadow() {
249: if (_primaryControlDarkShadow != null)
250: return _primaryControlDarkShadow;
251:
252: return super .getPrimaryControlDarkShadow();
253: }
254:
255: public ColorUIResource getPrimaryControlHighlight() {
256: if (_primaryControlHighlight != null)
257: return _primaryControlHighlight;
258: return super .getPrimaryControlHighlight();
259: }
260:
261: public ColorUIResource getPrimaryControlInfo() {
262: if (_primaryControlInfo != null)
263: return _primaryControlInfo;
264:
265: return super .getPrimaryControlInfo();
266: }
267:
268: public ColorUIResource getPrimaryControlShadow() {
269: if (_primaryControlShadow != null)
270: return _primaryControlShadow;
271:
272: return super .getPrimaryControlShadow();
273: }
274:
275: // these are gray in Metal Default Theme
276: protected ColorUIResource getSecondary1() {
277: if (_secondary1 != null)
278: return _secondary1;
279:
280: return super .getSecondary1();
281: }
282:
283: protected ColorUIResource getSecondary2() {
284: if (_secondary2 != null)
285: return _secondary2;
286:
287: return super .getSecondary2();
288: }
289:
290: protected ColorUIResource getSecondary3() {
291: if (_secondary3 != null)
292: return _secondary3;
293:
294: return super .getSecondary3();
295: }
296:
297: public ColorUIResource getSeparatorBackground() {
298: if (_separatorBackground != null)
299: return _separatorBackground;
300: return super .getSeparatorBackground();
301: }
302:
303: public ColorUIResource getSeparatorForeground() {
304: if (_separatorForeground != null)
305: return _separatorForeground;
306:
307: return super .getSeparatorForeground();
308: }
309:
310: public FontUIResource getSubTextFont() {
311: if (_subTextFont != null)
312: return _subTextFont;
313: return super .getSubTextFont();
314: }
315:
316: /**
317: * Returns the color used, by default, for the text in labels
318: * and titled borders.
319: */
320: public ColorUIResource getSystemTextColor() {
321: if (_systemTextColor != null)
322: return _systemTextColor;
323:
324: return super .getSystemTextColor();
325: }
326:
327: public FontUIResource getSystemTextFont() {
328: if (_systemTextFont != null)
329: return _systemTextFont;
330: return super .getSystemTextFont();
331: }
332:
333: public ColorUIResource getTextHighlightColor() {
334: if (_textHighlightColor != null)
335: return _textHighlightColor;
336:
337: return super .getTextHighlightColor();
338: }
339:
340: public ColorUIResource getUserTextColor() {
341: if (_userTextColor != null)
342: return _userTextColor;
343:
344: return super .getUserTextColor();
345: }
346:
347: public FontUIResource getUserTextFont() {
348: if (_userTextFont != null)
349: return _userTextFont;
350:
351: return super .getUserTextFont();
352: }
353:
354: protected ColorUIResource getWhite() {
355: if (_white != null)
356: return _white;
357: return super .getWhite();
358: }
359:
360: public ColorUIResource getWindowBackground() {
361: if (_windowBackground != null)
362: return _windowBackground;
363: return super .getWindowBackground();
364: }
365:
366: public ColorUIResource getWindowTitleBackground() {
367: if (_windowTitleBackground != null)
368: return _windowTitleBackground;
369:
370: return super .getWindowTitleBackground();
371: }
372:
373: public FontUIResource getWindowTitleFont() {
374: if (_windowTitleFont != null)
375: return _windowTitleFont;
376:
377: return super .getWindowTitleFont();
378: }
379:
380: public ColorUIResource getWindowTitleForeground() {
381: if (_windowTitleForeground != null)
382: return _windowTitleForeground;
383:
384: return super .getWindowTitleForeground();
385: }
386:
387: public ColorUIResource getWindowTitleInactiveBackground() {
388: if (_windowInactiveBackground != null)
389: return _windowInactiveBackground;
390:
391: return super .getWindowTitleInactiveBackground();
392: }
393:
394: public ColorUIResource getWindowTitleInactiveForeground() {
395: if (_windowTitleInactiveForeground != null)
396: return _windowTitleInactiveForeground;
397:
398: return super .getWindowTitleInactiveForeground();
399: }
400:
401: public void setAcceleratorForeground(
402: ColorUIResource acceleratorForeground) {
403: _acceleratorForeground = acceleratorForeground;
404: }
405:
406: public void setAcceleratorSelectedForeground(
407: ColorUIResource acceleratorSelectedForeground) {
408: _acceleratorSelectedForeground = acceleratorSelectedForeground;
409: }
410:
411: public void setBlack(ColorUIResource black) {
412: _black = black;
413: }
414:
415: public void setControl(ColorUIResource control) {
416: _control = control;
417: }
418:
419: public void setControlDarkShadow(ColorUIResource controlDarkShadow) {
420: _controlDarkShadow = controlDarkShadow;
421: }
422:
423: public void setControlDisabled(ColorUIResource controlDisabled) {
424: _controlDisabled = controlDisabled;
425: }
426:
427: public void setControlHighlight(ColorUIResource controlHighlight) {
428: _controlHighlight = controlHighlight;
429: }
430:
431: public void setControlInfo(ColorUIResource controlInfo) {
432: _controlInfo = controlInfo;
433: }
434:
435: public void setControlShadow(ColorUIResource controlShadow) {
436: _controlShadow = controlShadow;
437: }
438:
439: public void setControlTextColor(ColorUIResource controlTextColor) {
440: _controlTextColor = controlTextColor;
441: }
442:
443: public void setControlTextFont(FontUIResource controlTextFont) {
444: _controlTextFont = controlTextFont;
445: }
446:
447: public void setDesktopColor(ColorUIResource desktopColor) {
448: _desktopColor = desktopColor;
449: }
450:
451: public void setFocusColor(ColorUIResource focusColor) {
452: _focusColor = focusColor;
453: }
454:
455: public void setHighlightedTextColor(
456: ColorUIResource highlightedTextColor) {
457: _highlightedTextColor = highlightedTextColor;
458: }
459:
460: public void setInactiveSystemTextColor(
461: ColorUIResource inactiveSystemTextColor) {
462: _inactiveSystemTextColor = inactiveSystemTextColor;
463: }
464:
465: public void setInactiveTextColor(ColorUIResource inactiveTextColor) {
466: _inactiveTextColor = inactiveTextColor;
467: }
468:
469: public void setMenuBackground(ColorUIResource menuBackground) {
470: _menuBackground = menuBackground;
471: }
472:
473: public void setMenuDisabledForeground(
474: ColorUIResource menuDisabledForeground) {
475: _menuDisabledForeground = menuDisabledForeground;
476: }
477:
478: public void setMenuForeground(ColorUIResource menuForeground) {
479: _menuForeground = menuForeground;
480: }
481:
482: public void setMenuSelectedBackground(
483: ColorUIResource menuSelectedBackground) {
484: _menuSelectedBackground = menuSelectedBackground;
485: }
486:
487: public void setMenuSelectedForeground(
488: ColorUIResource menuSelectedForeground) {
489: _menuSelectedForeground = menuSelectedForeground;
490: }
491:
492: public void setMenuTextFont(FontUIResource menuTextFont) {
493: _menuTextFont = menuTextFont;
494: }
495:
496: public void setPrimary1(ColorUIResource primary1) {
497: _primary1 = primary1;
498: }
499:
500: public void setPrimary2(ColorUIResource primary2) {
501: _primary2 = primary2;
502: }
503:
504: public void setPrimary3(ColorUIResource primary3) {
505: _primary3 = primary3;
506: }
507:
508: public void setPrimaryControl(ColorUIResource primaryControl) {
509: _primaryControl = primaryControl;
510: }
511:
512: public void setPrimaryControlDarkShadow(
513: ColorUIResource primaryControlDarkShadow) {
514: _primaryControlDarkShadow = primaryControlDarkShadow;
515: }
516:
517: public void setPrimaryControlHighlight(
518: ColorUIResource primaryControlHighlight) {
519: _primaryControlHighlight = primaryControlHighlight;
520: }
521:
522: public void setPrimaryControlInfo(ColorUIResource primaryControlInfo) {
523: _primaryControlInfo = primaryControlInfo;
524: }
525:
526: public void setPrimaryControlShadow(
527: ColorUIResource primaryControlShadow) {
528: _primaryControlShadow = primaryControlShadow;
529: }
530:
531: public void setSecondary1(ColorUIResource secondary1) {
532: _secondary1 = secondary1;
533: }
534:
535: public void setSecondary2(ColorUIResource secondary2) {
536: _secondary2 = secondary2;
537: }
538:
539: public void setSecondary3(ColorUIResource secondary3) {
540: _secondary3 = secondary3;
541: }
542:
543: public void setSeparatorBackground(
544: ColorUIResource separatorBackground) {
545: _separatorBackground = separatorBackground;
546: }
547:
548: public void setSeparatorForeground(
549: ColorUIResource separatorForeground) {
550: _separatorForeground = separatorForeground;
551: }
552:
553: public void setSubTextFont(FontUIResource subTextFont) {
554: _subTextFont = subTextFont;
555: }
556:
557: public void setSystemTextColor(ColorUIResource systemTextColor) {
558: _systemTextColor = systemTextColor;
559: }
560:
561: public void setSystemTextFont(FontUIResource systemTextFont) {
562: _systemTextFont = systemTextFont;
563: }
564:
565: public void setTextHighlightColor(ColorUIResource textHighlightColor) {
566: _textHighlightColor = textHighlightColor;
567: }
568:
569: public void setUserTextColor(ColorUIResource userTextColor) {
570: _userTextColor = userTextColor;
571: }
572:
573: public void setUserTextFont(FontUIResource userTextFont) {
574: _userTextFont = userTextFont;
575: }
576:
577: public void setWhite(ColorUIResource white) {
578: _white = white;
579: }
580:
581: public void setWindowBackground(ColorUIResource windowBackground) {
582: _windowBackground = windowBackground;
583: }
584:
585: public void setWindowInactiveBackground(
586: ColorUIResource windowInactiveBackground) {
587: _windowInactiveBackground = windowInactiveBackground;
588: }
589:
590: public void setWindowTitleBackground(
591: ColorUIResource windowTitleBackground) {
592: _windowTitleBackground = windowTitleBackground;
593: }
594:
595: public void setWindowTitleFont(FontUIResource windowTitleFont) {
596: _windowTitleFont = windowTitleFont;
597: }
598:
599: public void setWindowTitleForeground(
600: ColorUIResource windowTitleForeground) {
601: _windowTitleForeground = windowTitleForeground;
602: }
603:
604: public void setWindowTitleInactiveForeground(
605: ColorUIResource windowTitleInactiveForeground) {
606: _windowTitleInactiveForeground = windowTitleInactiveForeground;
607: }
608: }
|