1:
37:
38:
39: package ;
40:
41: import ;
42:
43: import ;
44: import ;
45:
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55:
56:
57:
71: public class MetalLookAndFeel extends BasicLookAndFeel
72: {
73: private static final long serialVersionUID = 6680646159193457980L;
74:
75:
76: private static MetalTheme theme;
77:
78:
81: public MetalLookAndFeel()
82: {
83:
84: }
85:
86:
89: protected void createDefaultTheme()
90: {
91: getCurrentTheme();
92: }
93:
94:
101: public boolean isNativeLookAndFeel()
102: {
103: return false;
104: }
105:
106:
112: public boolean isSupportedLookAndFeel()
113: {
114: return true;
115: }
116:
117:
123: public String getDescription()
124: {
125: return "The Java(tm) Look and Feel";
126: }
127:
128:
133: public String getID()
134: {
135: return "Metal";
136: }
137:
138:
143: public String getName()
144: {
145: return "Metal";
146: }
147:
148: public UIDefaults getDefaults()
149: {
150: createDefaultTheme();
151: UIDefaults def = super.getDefaults();
152:
153: theme.addCustomEntriesToTable(def);
154: return def;
155: }
156:
157:
162: public static ColorUIResource getAcceleratorForeground()
163: {
164: if (theme != null)
165: return theme.getAcceleratorForeground();
166: return null;
167: }
168:
169:
175: public static ColorUIResource getAcceleratorSelectedForeground()
176: {
177: if (theme != null)
178: return theme.getAcceleratorSelectedForeground();
179: return null;
180: }
181:
182:
187: public static ColorUIResource getBlack()
188: {
189: if (theme != null)
190: return theme.getBlack();
191: return null;
192: }
193:
194:
199: public static ColorUIResource getControl()
200: {
201: if (theme != null)
202: return theme.getControl();
203: return null;
204: }
205:
206:
212: public static ColorUIResource getControlDarkShadow()
213: {
214: if (theme != null)
215: return theme.getControlDarkShadow();
216: return null;
217: }
218:
219:
224: public static ColorUIResource getControlDisabled()
225: {
226: if (theme != null)
227: return theme.getControlDisabled();
228: return null;
229: }
230:
231:
237: public static ColorUIResource getControlHighlight()
238: {
239: if (theme != null)
240: return theme.getControlHighlight();
241: return null;
242: }
243:
244:
250: public static ColorUIResource getControlInfo()
251: {
252: if (theme != null)
253: return theme.getControlInfo();
254: return null;
255: }
256:
257:
263: public static ColorUIResource getControlShadow()
264: {
265: if (theme != null)
266: return theme.getControlShadow();
267: return null;
268: }
269:
270:
275: public static ColorUIResource getControlTextColor()
276: {
277: if (theme != null)
278: return theme.getControlTextColor();
279: return null;
280: }
281:
282:
287: public static FontUIResource getControlTextFont()
288: {
289: if (theme != null)
290: return theme.getControlTextFont();
291: return null;
292: }
293:
294:
300: public static ColorUIResource getDesktopColor()
301: {
302: if (theme != null)
303: return theme.getDesktopColor();
304: return null;
305: }
306:
307:
313: public static ColorUIResource getFocusColor()
314: {
315: if (theme != null)
316: return theme.getFocusColor();
317: return null;
318: }
319:
320:
326: public static ColorUIResource getHighlightedTextColor()
327: {
328: if (theme != null)
329: return theme.getHighlightedTextColor();
330: return null;
331: }
332:
333:
339: public static ColorUIResource getInactiveControlTextColor()
340: {
341: if (theme != null)
342: return theme.getInactiveControlTextColor();
343: return null;
344: }
345:
346:
352: public static ColorUIResource getInactiveSystemTextColor()
353: {
354: if (theme != null)
355: return theme.getInactiveSystemTextColor();
356: return null;
357: }
358:
359:
366: public static ColorUIResource getMenuBackground()
367: {
368: if (theme != null)
369: return theme.getMenuBackground();
370: return null;
371: }
372:
373:
381: public static ColorUIResource getMenuDisabledForeground()
382: {
383: if (theme != null)
384: return theme.getMenuDisabledForeground();
385: return null;
386: }
387:
388:
396: public static ColorUIResource getMenuForeground()
397: {
398: if (theme != null)
399: return theme.getMenuForeground();
400: return null;
401: }
402:
403:
411: public static ColorUIResource getMenuSelectedBackground()
412: {
413: if (theme != null)
414: return theme.getMenuSelectedBackground();
415: return null;
416: }
417:
418:
426: public static ColorUIResource getMenuSelectedForeground()
427: {
428: if (theme != null)
429: return theme.getMenuSelectedForeground();
430: return null;
431: }
432:
433:
438: public static FontUIResource getMenuTextFont()
439: {
440: if (theme != null)
441: return theme.getMenuTextFont();
442: return null;
443: }
444:
445:
450: public static ColorUIResource getPrimaryControl()
451: {
452: if (theme != null)
453: return theme.getPrimaryControl();
454: return null;
455: }
456:
457:
463: public static ColorUIResource getPrimaryControlDarkShadow()
464: {
465: if (theme != null)
466: return theme.getPrimaryControlDarkShadow();
467: return null;
468: }
469:
470:
476: public static ColorUIResource getPrimaryControlHighlight()
477: {
478: if (theme != null)
479: return theme.getPrimaryControlHighlight();
480: return null;
481: }
482:
483:
489: public static ColorUIResource getPrimaryControlInfo()
490: {
491: if (theme != null)
492: return theme.getPrimaryControlInfo();
493: return null;
494: }
495:
496:
502: public static ColorUIResource getPrimaryControlShadow()
503: {
504: if (theme != null)
505: return theme.getPrimaryControlShadow();
506: return null;
507: }
508:
509:
514: public static ColorUIResource getSeparatorBackground()
515: {
516: if (theme != null)
517: return theme.getSeparatorBackground();
518: return null;
519: }
520:
521:
526: public static ColorUIResource getSeparatorForeground()
527: {
528: if (theme != null)
529: return theme.getSeparatorForeground();
530: return null;
531: }
532:
533:
538: public static FontUIResource getSubTextFont()
539: {
540: if (theme != null)
541: return theme.getSubTextFont();
542: return null;
543: }
544:
545:
550: public static ColorUIResource getSystemTextColor()
551: {
552: if (theme != null)
553: return theme.getSystemTextColor();
554: return null;
555: }
556:
557:
562: public static FontUIResource getSystemTextFont()
563: {
564: if (theme != null)
565: return theme.getSystemTextFont();
566: return null;
567: }
568:
569:
574: public static ColorUIResource getTextHighlightColor()
575: {
576: if (theme != null)
577: return theme.getTextHighlightColor();
578: return null;
579: }
580:
581:
586: public static ColorUIResource getUserTextColor()
587: {
588: if (theme != null)
589: return theme.getUserTextColor();
590: return null;
591: }
592:
593:
598: public static FontUIResource getUserTextFont()
599: {
600: if (theme != null)
601: return theme.getUserTextFont();
602: return null;
603: }
604:
605:
610: public static ColorUIResource getWhite()
611: {
612: if (theme != null)
613: return theme.getWhite();
614: return null;
615: }
616:
617:
622: public static ColorUIResource getWindowBackground()
623: {
624: if (theme != null)
625: return theme.getWindowBackground();
626: return null;
627: }
628:
629:
634: public static ColorUIResource getWindowTitleBackground()
635: {
636: if (theme != null)
637: return theme.getWindowTitleBackground();
638: return null;
639: }
640:
641:
648: public static FontUIResource getWindowTitleFont()
649: {
650: if (theme != null)
651: return theme.getWindowTitleFont();
652: return null;
653: }
654:
655:
660: public static ColorUIResource getWindowTitleForeground()
661: {
662: if (theme != null)
663: return theme.getWindowTitleForeground();
664: return null;
665: }
666:
667:
673: public static ColorUIResource getWindowTitleInactiveBackground()
674: {
675: if (theme != null)
676: return theme.getWindowTitleInactiveBackground();
677: return null;
678: }
679:
680:
686: public static ColorUIResource getWindowTitleInactiveForeground()
687: {
688: if (theme != null)
689: return theme.getWindowTitleInactiveForeground();
690: return null;
691: }
692:
693:
707: public static void setCurrentTheme(MetalTheme theme)
708: {
709: if (theme == null)
710: throw new NullPointerException("Null 'theme' not permitted.");
711: MetalLookAndFeel.theme = theme;
712: }
713:
714:
770: protected void initClassDefaults(UIDefaults defaults)
771: {
772: super.initClassDefaults(defaults);
773:
774:
775: Object[] uiDefaults;
776:
777: uiDefaults = new Object[] {
778: "ButtonUI", "javax.swing.plaf.metal.MetalButtonUI",
779: "CheckBoxUI", "javax.swing.plaf.metal.MetalCheckBoxUI",
780: "ComboBoxUI", "javax.swing.plaf.metal.MetalComboBoxUI",
781: "DesktopIconUI", "javax.swing.plaf.metal.MetalDesktopIconUI",
782: "FileChooserUI", "javax.swing.plaf.metal.MetalFileChooserUI",
783: "InternalFrameUI", "javax.swing.plaf.metal.MetalInternalFrameUI",
784: "LabelUI", "javax.swing.plaf.metal.MetalLabelUI",
785: "MenuBarUI", "javax.swing.plaf.metal.MetalMenuBarUI",
786: "PopupMenuSeparatorUI",
787: "javax.swing.plaf.metal.MetalPopupMenuSeparatorUI",
788: "ProgressBarUI", "javax.swing.plaf.metal.MetalProgressBarUI",
789: "RadioButtonUI", "javax.swing.plaf.metal.MetalRadioButtonUI",
790: "RootPaneUI", "javax.swing.plaf.metal.MetalRootPaneUI",
791: "ScrollBarUI", "javax.swing.plaf.metal.MetalScrollBarUI",
792: "ScrollPaneUI", "javax.swing.plaf.metal.MetalScrollPaneUI",
793: "SeparatorUI", "javax.swing.plaf.metal.MetalSeparatorUI",
794: "SliderUI", "javax.swing.plaf.metal.MetalSliderUI",
795: "SplitPaneUI", "javax.swing.plaf.metal.MetalSplitPaneUI",
796: "TabbedPaneUI", "javax.swing.plaf.metal.MetalTabbedPaneUI",
797: "TextFieldUI", "javax.swing.plaf.metal.MetalTextFieldUI",
798: "ToggleButtonUI", "javax.swing.plaf.metal.MetalToggleButtonUI",
799: "ToolBarUI", "javax.swing.plaf.metal.MetalToolBarUI",
800: "ToolTipUI", "javax.swing.plaf.metal.MetalToolTipUI",
801: "TreeUI", "javax.swing.plaf.metal.MetalTreeUI",
802: };
803:
804: defaults.putDefaults(uiDefaults);
805: }
806:
807:
861: protected void initComponentDefaults(UIDefaults defaults)
862: {
863: super.initComponentDefaults(defaults);
864: Object[] myDefaults = new Object[] {
865: "Button.background", getControl(),
866: "Button.border", MetalBorders.getButtonBorder(),
867: "Button.darkShadow", getControlDarkShadow(),
868: "Button.disabledText", getInactiveControlTextColor(),
869: "Button.focus", getFocusColor(),
870: "Button.font", getControlTextFont(),
871: "Button.foreground", getControlTextColor(),
872: "Button.highlight", getControlHighlight(),
873: "Button.light", getControlHighlight(),
874: "Button.margin", new InsetsUIResource(2, 14, 2, 14),
875: "Button.select", getControlShadow(),
876: "Button.shadow", getControlShadow(),
877:
878: "CheckBox.background", getControl(),
879: "CheckBox.border", MetalBorders.getButtonBorder(),
880: "CheckBox.disabledText", getInactiveControlTextColor(),
881: "CheckBox.focus", getFocusColor(),
882: "CheckBox.font", getControlTextFont(),
883: "CheckBox.foreground", getControlTextColor(),
884: "CheckBox.icon",
885: new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalCheckBoxIcon"),
886: "CheckBox.checkIcon",
887: new UIDefaults.ProxyLazyValue("javax.swing.plaf.metal.MetalCheckBoxIcon"),
888: "Checkbox.select", getControlShadow(),
889:
890: "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
891: "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(),
892: "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
893: "CheckBoxMenuItem.background", getMenuBackground(),
894: "CheckBoxMenuItem.borderPainted", Boolean.TRUE,
895: "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav",
896: "CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(),
897: "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(),
898: "CheckBoxMenuItem.font", getMenuTextFont(),
899: "CheckBoxMenuItem.foreground", getMenuForeground(),
900: "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(),
901: "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(),
902:
903: "ColorChooser.background", getControl(),
904: "ColorChooser.foreground", getControlTextColor(),
905: "ColorChooser.rgbBlueMnemonic", new Integer(0),
906: "ColorChooser.rgbGreenMnemonic", new Integer(0),
907: "ColorChooser.rgbRedMnemonic", new Integer(0),
908: "ColorChooser.swatchesDefaultRecentColor", getControl(),
909:
910: "ComboBox.background", getControl(),
911: "ComboBox.buttonBackground", getControl(),
912: "ComboBox.buttonDarkShadow", getControlDarkShadow(),
913: "ComboBox.buttonHighlight", getControlHighlight(),
914: "ComboBox.buttonShadow", getControlShadow(),
915: "ComboBox.disabledBackground", getControl(),
916: "ComboBox.disabledForeground", getInactiveSystemTextColor(),
917: "ComboBox.font", getControlTextFont(),
918: "ComboBox.foreground", getControlTextColor(),
919: "ComboBox.selectionBackground", getPrimaryControlShadow(),
920: "ComboBox.selectionForeground", getControlTextColor(),
921:
922: "Desktop.background", getDesktopColor(),
923:
924: "DesktopIcon.background", getControl(),
925: "DesktopIcon.foreground", getControlTextColor(),
926: "DesktopIcon.width", new Integer(160),
927: "DesktopIcon.border", MetalBorders.getDesktopIconBorder(),
928: "DesktopIcon.font", getControlTextFont(),
929:
930: "EditorPane.background", getWindowBackground(),
931: "EditorPane.caretForeground", getUserTextColor(),
932: "EditorPane.font", getControlTextFont(),
933: "EditorPane.foreground", getUserTextColor(),
934: "EditorPane.inactiveForeground", getInactiveSystemTextColor(),
935: "EditorPane.selectionBackground", getTextHighlightColor(),
936: "EditorPane.selectionForeground", getHighlightedTextColor(),
937:
938: "FormattedTextField.background", getWindowBackground(),
939: "FormattedTextField.border",
940: new BorderUIResource(MetalBorders.getTextFieldBorder()),
941: "FormattedTextField.caretForeground", getUserTextColor(),
942: "FormattedTextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
943: "FormattedTextField.foreground", getUserTextColor(),
944: "FormattedTextField.inactiveBackground", getControl(),
945: "FormattedTextField.inactiveForeground", getInactiveSystemTextColor(),
946: "FormattedTextField.selectionBackground", getTextHighlightColor(),
947: "FormattedTextField.selectionForeground", getHighlightedTextColor(),
948:
949: "FileChooser.upFolderIcon",
950: MetalIconFactory.getFileChooserUpFolderIcon(),
951: "FileChooser.listViewIcon",
952: MetalIconFactory.getFileChooserListViewIcon(),
953: "FileChooser.newFolderIcon",
954: MetalIconFactory.getFileChooserNewFolderIcon(),
955: "FileChooser.homeFolderIcon",
956: MetalIconFactory.getFileChooserHomeFolderIcon(),
957: "FileChooser.detailsViewIcon",
958: MetalIconFactory.getFileChooserDetailViewIcon(),
959: "FileChooser.fileNameLabelMnemonic", new Integer(78),
960: "FileChooser.filesOfTypeLabelMnemonic", new Integer(84),
961: "FileChooser.lookInLabelMnemonic", new Integer(73),
962: "FileView.computerIcon", MetalIconFactory.getTreeComputerIcon(),
963: "FileView.directoryIcon", MetalIconFactory.getTreeFolderIcon(),
964: "FileView.fileIcon", MetalIconFactory.getTreeLeafIcon(),
965: "FileView.floppyDriveIcon", MetalIconFactory.getTreeFloppyDriveIcon(),
966: "FileView.hardDriveIcon", MetalIconFactory.getTreeHardDriveIcon(),
967:
968: "InternalFrame.activeTitleBackground", getWindowTitleBackground(),
969: "InternalFrame.activeTitleForeground", getWindowTitleForeground(),
970: "InternalFrame.border", new MetalBorders.InternalFrameBorder(),
971: "InternalFrame.borderColor", getControl(),
972: "InternalFrame.borderDarkShadow", getControlDarkShadow(),
973: "InternalFrame.borderHighlight", getControlHighlight(),
974: "InternalFrame.borderLight", getControlHighlight(),
975: "InternalFrame.borderShadow", getControlShadow(),
976: "InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(),
977: "InternalFrame.closeIcon",
978: MetalIconFactory.getInternalFrameCloseIcon(16),
979: "InternalFrame.closeSound", "sounds/FrameClose.wav",
980: "InternalFrame.inactiveTitleBackground", getWindowTitleInactiveBackground(),
981: "InternalFrame.inactiveTitleForeground", getWindowTitleInactiveForeground(),
982: "InternalFrame.maximizeIcon",
983: MetalIconFactory.getInternalFrameMaximizeIcon(16),
984: "InternalFrame.maximizeSound", "sounds/FrameMaximize.wav",
985: "InternalFrame.iconifyIcon",
986: MetalIconFactory.getInternalFrameMinimizeIcon(16),
987: "InternalFrame.minimizeSound", "sounds/FrameMinimize.wav",
988: "InternalFrame.paletteBorder", new MetalBorders.PaletteBorder(),
989: "InternalFrame.paletteCloseIcon", new MetalIconFactory.PaletteCloseIcon(),
990: "InternalFrame.paletteTitleHeight", new Integer(11),
991: "InternalFrame.restoreDownSound", "sounds/FrameRestoreDown.wav",
992: "InternalFrame.restoreUpSound", "sounds/FrameRestoreUp.wav",
993:
994: "Label.background", getControl(),
995: "Label.disabledForeground", getInactiveSystemTextColor(),
996: "Label.disabledShadow", getControlShadow(),
997: "Label.font", getControlTextFont(),
998: "Label.foreground", getSystemTextColor(),
999:
1000: "List.font", getControlTextFont(),
1001: "List.background", getWindowBackground(),
1002: "List.foreground", getUserTextColor(),
1003: "List.selectionBackground", getTextHighlightColor(),
1004: "List.selectionForeground", getHighlightedTextColor(),
1005: "List.focusCellHighlightBorder",
1006: new LineBorderUIResource(MetalLookAndFeel.getFocusColor()),
1007:
1008: "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
1009: "Menu.acceleratorForeground", getAcceleratorForeground(),
1010: "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
1011: "Menu.arrowIcon", MetalIconFactory.getMenuArrowIcon(),
1012: "Menu.background", getMenuBackground(),
1013: "Menu.border", new MetalBorders.MenuItemBorder(),
1014: "Menu.borderPainted", Boolean.TRUE,
1015: "MenuItem.commandSound", "sounds/MenuItemCommand.wav",
1016: "Menu.disabledForeground", getMenuDisabledForeground(),
1017: "Menu.font", getMenuTextFont(),
1018: "Menu.foreground", getMenuForeground(),
1019: "Menu.selectionBackground", getMenuSelectedBackground(),
1020: "Menu.selectionForeground", getMenuSelectedForeground(),
1021: "Menu.submenuPopupOffsetX", new Integer(-4),
1022: "Menu.submenuPopupOffsetY", new Integer(-3),
1023:
1024: "MenuBar.background", getMenuBackground(),
1025: "MenuBar.border", new MetalBorders.MenuBarBorder(),
1026: "MenuBar.font", getMenuTextFont(),
1027: "MenuBar.foreground", getMenuForeground(),
1028: "MenuBar.highlight", getControlHighlight(),
1029: "MenuBar.shadow", getControlShadow(),
1030:
1031: "MenuItem.acceleratorDelimiter", "-",
1032: "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
1033: "MenuItem.acceleratorForeground", getAcceleratorForeground(),
1034: "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
1035: "MenuItem.arrowIcon", MetalIconFactory.getMenuItemArrowIcon(),
1036: "MenuItem.background", getMenuBackground(),
1037: "MenuItem.border", new MetalBorders.MenuItemBorder(),
1038: "MenuItem.borderPainted", Boolean.TRUE,
1039: "MenuItem.disabledForeground", getMenuDisabledForeground(),
1040: "MenuItem.font", getMenuTextFont(),
1041: "MenuItem.foreground", getMenuForeground(),
1042: "MenuItem.selectionBackground", getMenuSelectedBackground(),
1043: "MenuItem.selectionForeground", getMenuSelectedForeground(),
1044:
1045: "OptionPane.background", getControl(),
1046: "OptionPane.errorSound", "sounds/OptionPaneError.wav",
1047: "OptionPane.informationSound", "sounds/OptionPaneInformation.wav",
1048: "OptionPane.questionSound", "sounds/OptionPaneQuestion.wav",
1049: "OptionPane.warningSound", "sounds/OptionPaneWarning.wav",
1050: "OptionPane.errorDialog.border.background", new ColorUIResource(153, 51, 51),
1051: "OptionPane.errorDialog.titlePane.background", new ColorUIResource(255, 153, 153),
1052: "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(51, 0, 0),
1053: "OptionPane.errorDialog.titlePane.shadow", new ColorUIResource(204, 102, 102),
1054: "OptionPane.foreground", getControlTextColor(),
1055: "OptionPane.messageForeground", getControlTextColor(),
1056: "OptionPane.questionDialog.border.background", new ColorUIResource(51, 102, 51),
1057: "OptionPane.questionDialog.titlePane.background", new ColorUIResource(153, 204, 153),
1058: "OptionPane.questionDialog.titlePane.foreground", new ColorUIResource(0, 51, 0),
1059: "OptionPane.questionDialog.titlePane.shadow", new ColorUIResource(102, 153, 102),
1060: "OptionPane.warningDialog.border.background", new ColorUIResource(153, 102, 51),
1061: "OptionPane.warningDialog.titlePane.background", new ColorUIResource(255, 204, 153),
1062: "OptionPane.warningDialog.titlePane.foreground", new ColorUIResource(102, 51, 0),
1063: "OptionPane.warningDialog.titlePane.shadow", new ColorUIResource(204, 153, 102),
1064:
1065: "Panel.background", getControl(),
1066: "Panel.foreground", getUserTextColor(),
1067:
1068: "PasswordField.background", getWindowBackground(),
1069: "PasswordField.border",
1070: new BorderUIResource(MetalBorders.getTextFieldBorder()),
1071: "PasswordField.caretForeground", getUserTextColor(),
1072: "PasswordField.foreground", getUserTextColor(),
1073: "PasswordField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1074: "PasswordField.inactiveBackground", getControl(),
1075: "PasswordField.inactiveForeground", getInactiveSystemTextColor(),
1076: "PasswordField.selectionBackground", getTextHighlightColor(),
1077: "PasswordField.selectionForeground", getHighlightedTextColor(),
1078:
1079: "PopupMenu.background", getMenuBackground(),
1080: "PopupMenu.border", new MetalBorders.PopupMenuBorder(),
1081: "PopupMenu.font", getMenuTextFont(),
1082: "PopupMenu.foreground", getMenuForeground(),
1083: "PopupMenu.popupSound", "sounds/PopupMenuPopup.wav",
1084:
1085: "ProgressBar.background", getControl(),
1086: "ProgressBar.border", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
1087: "ProgressBar.font", getControlTextFont(),
1088: "ProgressBar.foreground", getPrimaryControlShadow(),
1089: "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(),
1090: "ProgressBar.selectionForeground", getControl(),
1091:
1092: "RadioButton.background", getControl(),
1093: "RadioButton.darkShadow", getControlDarkShadow(),
1094: "RadioButton.disabledText", getInactiveControlTextColor(),
1095: "RadioButton.icon",
1096: new UIDefaults.LazyValue()
1097: {
1098: public Object createValue(UIDefaults def)
1099: {
1100: return MetalIconFactory.getRadioButtonIcon();
1101: }
1102: },
1103: "RadioButton.focus", MetalLookAndFeel.getFocusColor(),
1104: "RadioButton.font", MetalLookAndFeel.getControlTextFont(),
1105: "RadioButton.foreground", getControlTextColor(),
1106: "RadioButton.highlight", getControlHighlight(),
1107: "RadioButton.light", getControlHighlight(),
1108: "RadioButton.select", getControlShadow(),
1109: "RadioButton.shadow", getControlShadow(),
1110:
1111: "RadioButtonMenuItem.acceleratorFont", new Font("Dialog", Font.PLAIN, 10),
1112: "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(),
1113: "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
1114: "RadioButtonMenuItem.background", getMenuBackground(),
1115: "RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(),
1116: "RadioButtonMenuItem.borderPainted", Boolean.TRUE,
1117: "RadioButtonMenuItem.checkIcon",
1118: MetalIconFactory.getRadioButtonMenuItemIcon(),
1119: "RadioButtonMenuItem.commandSound", "sounds/MenuItemCommand.wav",
1120: "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(),
1121: "RadioButtonMenuItem.font", getMenuTextFont(),
1122: "RadioButtonMenuItem.foreground", getMenuForeground(),
1123: "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
1124: "RadioButtonMenuItem.selectionBackground",
1125: MetalLookAndFeel.getMenuSelectedBackground(),
1126: "RadioButtonMenuItem.selectionForeground",
1127: MetalLookAndFeel.getMenuSelectedForeground(),
1128:
1129: "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
1130: "ScrollBar.background", getControl(),
1131: "ScrollBar.darkShadow", getControlDarkShadow(),
1132: "ScrollBar.foreground", getControl(),
1133: "ScrollBar.highlight", getControlHighlight(),
1134: "ScrollBar.shadow", getControlShadow(),
1135: "ScrollBar.thumb", getPrimaryControlShadow(),
1136: "ScrollBar.thumbDarkShadow", getControlDarkShadow(),
1137: "ScrollBar.thumbHighlight", getPrimaryControl(),
1138: "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(),
1139: "ScrollBar.track", getControl(),
1140: "ScrollBar.trackHighlight", getControlDarkShadow(),
1141: "ScrollBar.width", new Integer(17),
1142:
1143: "ScrollPane.background", getControl(),
1144: "ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
1145: "ScrollPane.foreground", getControlTextColor(),
1146:
1147: "Separator.background", getSeparatorBackground(),
1148: "Separator.foreground", getSeparatorForeground(),
1149: "Separator.highlight", getControlHighlight(),
1150: "Separator.shadow", getControlShadow(),
1151:
1152: "Slider.background", getControl(),
1153: "Slider.focus", getFocusColor(),
1154: "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0),
1155: "Slider.foreground", getPrimaryControlShadow(),
1156: "Slider.highlight", getControlHighlight(),
1157: "Slider.horizontalThumbIcon",
1158: MetalIconFactory.getHorizontalSliderThumbIcon(),
1159: "Slider.majorTickLength", new Integer(6),
1160: "Slider.shadow", getControlShadow(),
1161: "Slider.trackWidth", new Integer(7),
1162: "Slider.verticalThumbIcon",
1163: MetalIconFactory.getVerticalSliderThumbIcon(),
1164:
1165: "Spinner.arrowButtonInsets", new InsetsUIResource(0, 0, 0, 0),
1166: "Spinner.background", getControl(),
1167: "Spinner.border", MetalBorders.getTextFieldBorder(),
1168: "Spinner.font", getControlTextFont(),
1169: "Spinner.foreground", getControl(),
1170:
1171: "SplitPane.background", getControl(),
1172: "SplitPane.darkShadow", getControlDarkShadow(),
1173: "SplitPane.dividerFocusColor", getPrimaryControl(),
1174: "SplitPane.dividerSize", new Integer(10),
1175: "SplitPane.highlight", getControlHighlight(),
1176: "SplitPane.shadow", getControlShadow(),
1177:
1178: "SplitPaneDivider.draggingColor", Color.DARK_GRAY,
1179:
1180: "TabbedPane.background", getControlShadow(),
1181: "TabbedPane.contentBorderInsets", new InsetsUIResource(2, 2, 3, 3),
1182: "TabbedPane.contentOpaque", Boolean.TRUE,
1183: "TabbedPane.darkShadow", getControlDarkShadow(),
1184: "TabbedPane.focus", getPrimaryControlDarkShadow(),
1185: "TabbedPane.font", getControlTextFont(),
1186: "TabbedPane.foreground", getControlTextColor(),
1187: "TabbedPane.highlight", getControlHighlight(),
1188: "TabbedPane.light", getControl(),
1189: "TabbedPane.selected", getControl(),
1190: "TabbedPane.selectHighlight", getControlHighlight(),
1191: "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1),
1192: "TabbedPane.shadow", getControlShadow(),
1193: "TabbedPane.tabAreaBackground", getControl(),
1194: "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6),
1195: "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
1196:
1197:
1198:
1199:
1200:
1201: "Table.background", getWindowBackground(),
1202: "Table.focusCellBackground", getWindowBackground(),
1203: "Table.focusCellForeground", getControlTextColor(),
1204: "Table.foreground", getControlTextColor(),
1205: "Table.focusCellHighlightBorder",
1206: new BorderUIResource.LineBorderUIResource(getFocusColor()),
1207: "Table.focusCellBackground", getWindowBackground(),
1208: "Table.gridColor", getControlDarkShadow(),
1209: "Table.selectionBackground", new ColorUIResource(204, 204, 255),
1210: "Table.selectionForeground", new ColorUIResource(0, 0, 0),
1211:
1212: "TableHeader.background", getControl(),
1213: "TableHeader.cellBorder", new MetalBorders.TableHeaderBorder(),
1214: "TableHeader.foreground", getControlTextColor(),
1215:
1216: "TextArea.background", getWindowBackground(),
1217: "TextArea.caretForeground", getUserTextColor(),
1218: "TextArea.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1219: "TextArea.foreground", getUserTextColor(),
1220: "TextArea.inactiveForeground", getInactiveSystemTextColor(),
1221: "TextArea.selectionBackground", getTextHighlightColor(),
1222: "TextArea.selectionForeground", getHighlightedTextColor(),
1223:
1224: "TextField.background", getWindowBackground(),
1225: "TextField.border",
1226: new BorderUIResource(MetalBorders.getTextFieldBorder()),
1227: "TextField.caretForeground", getUserTextColor(),
1228: "TextField.darkShadow", getControlDarkShadow(),
1229: "TextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1230: "TextField.foreground", getUserTextColor(),
1231: "TextField.highlight", getControlHighlight(),
1232: "TextField.inactiveBackground", getControl(),
1233: "TextField.inactiveForeground", getInactiveSystemTextColor(),
1234: "TextField.light", getControlHighlight(),
1235: "TextField.selectionBackground", getTextHighlightColor(),
1236: "TextField.selectionForeground", getHighlightedTextColor(),
1237: "TextField.shadow", getControlShadow(),
1238:
1239: "TextPane.background", getWindowBackground(),
1240: "TextPane.caretForeground", getUserTextColor(),
1241: "TextPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1242: "TextPane.foreground", getUserTextColor(),
1243: "TextPane.inactiveForeground", getInactiveSystemTextColor(),
1244: "TextPane.selectionBackground", getTextHighlightColor(),
1245: "TextPane.selectionForeground", getHighlightedTextColor(),
1246:
1247: "TitledBorder.border", new LineBorderUIResource(getPrimaryControl(), 1),
1248: "TitledBorder.font", getControlTextFont(),
1249: "TitledBorder.titleColor", getSystemTextColor(),
1250:
1251: "ToggleButton.background", getControl(),
1252: "ToggleButton.border", MetalBorders.getToggleButtonBorder(),
1253: "ToggleButton.darkShadow", getControlDarkShadow(),
1254: "ToggleButton.disabledText", getInactiveControlTextColor(),
1255: "ToggleButton.focus", getFocusColor(),
1256: "ToggleButton.font", getControlTextFont(),
1257: "ToggleButton.foreground", getControlTextColor(),
1258: "ToggleButton.highlight", getControlHighlight(),
1259: "ToggleButton.light", getControlHighlight(),
1260: "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
1261: "ToggleButton.select", getControlShadow(),
1262: "ToggleButton.shadow", getControlShadow(),
1263:
1264: "ToolBar.background", getMenuBackground(),
1265: "ToolBar.darkShadow", getControlDarkShadow(),
1266: "ToolBar.dockingBackground", getMenuBackground(),
1267: "ToolBar.dockingForeground", getPrimaryControlDarkShadow(),
1268: "ToolBar.floatingBackground", getMenuBackground(),
1269: "ToolBar.floatingForeground", getPrimaryControl(),
1270: "ToolBar.font", getMenuTextFont(),
1271: "ToolBar.foreground", getMenuForeground(),
1272: "ToolBar.highlight", getControlHighlight(),
1273: "ToolBar.light", getControlHighlight(),
1274: "ToolBar.shadow", getControlShadow(),
1275: "ToolBar.border", new MetalBorders.ToolBarBorder(),
1276: "ToolBar.rolloverBorder", MetalBorders.getToolbarButtonBorder(),
1277: "ToolBar.nonrolloverBorder", MetalBorders.getToolbarButtonBorder(),
1278:
1279: "ToolTip.background", getPrimaryControl(),
1280: "ToolTip.backgroundInactive", getControl(),
1281: "ToolTip.border", new BorderUIResource.LineBorderUIResource(getPrimaryControlDarkShadow(), 1),
1282: "ToolTip.borderInactive", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
1283: "ToolTip.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1284: "ToolTip.foreground", getPrimaryControlInfo(),
1285: "ToolTip.foregroundInactive", getControlDarkShadow(),
1286: "ToolTip.hideAccelerator", Boolean.FALSE,
1287:
1288: "Tree.background", getWindowBackground(),
1289: "Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(),
1290: "Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true),
1291: "Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false),
1292: "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1293: "Tree.foreground", getUserTextColor(),
1294: "Tree.hash", getPrimaryControl(),
1295: "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
1296: "Tree.leftChildIndent", new Integer(7),
1297: "Tree.line", getPrimaryControl(),
1298: "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
1299: "Tree.rightChildIndent", new Integer(13),
1300: "Tree.rowHeight", new Integer(0),
1301: "Tree.scrollsOnExpand", Boolean.TRUE,
1302: "Tree.selectionBackground", getTextHighlightColor(),
1303: "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)),
1304: "Tree.selectionBorderColor", getFocusColor(),
1305: "Tree.selectionForeground", getHighlightedTextColor(),
1306: "Tree.textBackground", getWindowBackground(),
1307: "Tree.textForeground", getUserTextColor(),
1308:
1309: "Viewport.background", getControl(),
1310: "Viewport.foreground", getUserTextColor()
1311: };
1312: defaults.putDefaults(myDefaults);
1313: }
1314:
1315:
1328: protected void initSystemColorDefaults(UIDefaults defaults)
1329: {
1330: super.initSystemColorDefaults(defaults);
1331: Object[] uiDefaults;
1332: uiDefaults = new Object[] {
1333: "control", new ColorUIResource(getControl()),
1334: "desktop", new ColorUIResource(getDesktopColor())
1335: };
1336: defaults.putDefaults(uiDefaults);
1337: }
1338:
1339:
1347: public static MetalTheme getCurrentTheme()
1348: {
1349: if (theme == null)
1350: {
1351:
1352:
1353: if ("steel".equals(SystemProperties.getProperty("swing.metalTheme")))
1354: theme = new DefaultMetalTheme();
1355: else
1356: theme = new OceanTheme();
1357: }
1358: return theme;
1359: }
1360:
1361:
1368: public boolean getSupportsWindowDecorations()
1369: {
1370: return true;
1371: }
1372: }