1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43:
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53:
54:
55:
69: public class MetalLookAndFeel extends BasicLookAndFeel
70: {
71: private static final long serialVersionUID = 6680646159193457980L;
72:
73:
74: private static MetalTheme theme;
75:
76:
77: private UIDefaults LAF_defaults;
78:
79:
82: public MetalLookAndFeel()
83: {
84: createDefaultTheme();
85: }
86:
87:
90: protected void createDefaultTheme()
91: {
92: if (theme == null)
93: setCurrentTheme(new DefaultMetalTheme());
94: }
95:
96:
103: public boolean isNativeLookAndFeel()
104: {
105: return false;
106: }
107:
108:
114: public boolean isSupportedLookAndFeel()
115: {
116: return true;
117: }
118:
119:
125: public String getDescription()
126: {
127: return "The Java(tm) Look and Feel";
128: }
129:
130:
135: public String getID()
136: {
137: return "Metal";
138: }
139:
140:
145: public String getName()
146: {
147: return "Metal";
148: }
149:
150: public UIDefaults getDefaults()
151: {
152: if (LAF_defaults == null)
153: {
154: LAF_defaults = super.getDefaults();
155:
156:
157: if (theme != null)
158: theme.addCustomEntriesToTable(LAF_defaults);
159: }
160:
161:
162: return LAF_defaults;
163: }
164:
165:
170: public static ColorUIResource getAcceleratorForeground()
171: {
172: if (theme != null)
173: return theme.getAcceleratorForeground();
174: return null;
175: }
176:
177:
183: public static ColorUIResource getAcceleratorSelectedForeground()
184: {
185: if (theme != null)
186: return theme.getAcceleratorSelectedForeground();
187: return null;
188: }
189:
190:
195: public static ColorUIResource getBlack()
196: {
197: if (theme != null)
198: return theme.getBlack();
199: return null;
200: }
201:
202:
207: public static ColorUIResource getControl()
208: {
209: if (theme != null)
210: return theme.getControl();
211: return null;
212: }
213:
214:
220: public static ColorUIResource getControlDarkShadow()
221: {
222: if (theme != null)
223: return theme.getControlDarkShadow();
224: return null;
225: }
226:
227:
232: public static ColorUIResource getControlDisabled()
233: {
234: if (theme != null)
235: return theme.getControlDisabled();
236: return null;
237: }
238:
239:
245: public static ColorUIResource getControlHighlight()
246: {
247: if (theme != null)
248: return theme.getControlHighlight();
249: return null;
250: }
251:
252:
258: public static ColorUIResource getControlInfo()
259: {
260: if (theme != null)
261: return theme.getControlInfo();
262: return null;
263: }
264:
265:
271: public static ColorUIResource getControlShadow()
272: {
273: if (theme != null)
274: return theme.getControlShadow();
275: return null;
276: }
277:
278:
283: public static ColorUIResource getControlTextColor()
284: {
285: if (theme != null)
286: return theme.getControlTextColor();
287: return null;
288: }
289:
290:
295: public static FontUIResource getControlTextFont()
296: {
297: if (theme != null)
298: return theme.getControlTextFont();
299: return null;
300: }
301:
302:
308: public static ColorUIResource getDesktopColor()
309: {
310: if (theme != null)
311: return theme.getDesktopColor();
312: return null;
313: }
314:
315:
321: public static ColorUIResource getFocusColor()
322: {
323: if (theme != null)
324: return theme.getFocusColor();
325: return null;
326: }
327:
328:
334: public static ColorUIResource getHighlightedTextColor()
335: {
336: if (theme != null)
337: return theme.getHighlightedTextColor();
338: return null;
339: }
340:
341:
347: public static ColorUIResource getInactiveControlTextColor()
348: {
349: if (theme != null)
350: return theme.getInactiveControlTextColor();
351: return null;
352: }
353:
354:
360: public static ColorUIResource getInactiveSystemTextColor()
361: {
362: if (theme != null)
363: return theme.getInactiveSystemTextColor();
364: return null;
365: }
366:
367:
374: public static ColorUIResource getMenuBackground()
375: {
376: if (theme != null)
377: return theme.getMenuBackground();
378: return null;
379: }
380:
381:
389: public static ColorUIResource getMenuDisabledForeground()
390: {
391: if (theme != null)
392: return theme.getMenuDisabledForeground();
393: return null;
394: }
395:
396:
404: public static ColorUIResource getMenuForeground()
405: {
406: if (theme != null)
407: return theme.getMenuForeground();
408: return null;
409: }
410:
411:
419: public static ColorUIResource getMenuSelectedBackground()
420: {
421: if (theme != null)
422: return theme.getMenuSelectedBackground();
423: return null;
424: }
425:
426:
434: public static ColorUIResource getMenuSelectedForeground()
435: {
436: if (theme != null)
437: return theme.getMenuSelectedForeground();
438: return null;
439: }
440:
441:
446: public static FontUIResource getMenuTextFont()
447: {
448: if (theme != null)
449: return theme.getMenuTextFont();
450: return null;
451: }
452:
453:
458: public static ColorUIResource getPrimaryControl()
459: {
460: if (theme != null)
461: return theme.getPrimaryControl();
462: return null;
463: }
464:
465:
471: public static ColorUIResource getPrimaryControlDarkShadow()
472: {
473: if (theme != null)
474: return theme.getPrimaryControlDarkShadow();
475: return null;
476: }
477:
478:
484: public static ColorUIResource getPrimaryControlHighlight()
485: {
486: if (theme != null)
487: return theme.getPrimaryControlHighlight();
488: return null;
489: }
490:
491:
497: public static ColorUIResource getPrimaryControlInfo()
498: {
499: if (theme != null)
500: return theme.getPrimaryControlInfo();
501: return null;
502: }
503:
504:
510: public static ColorUIResource getPrimaryControlShadow()
511: {
512: if (theme != null)
513: return theme.getPrimaryControlShadow();
514: return null;
515: }
516:
517:
522: public static ColorUIResource getSeparatorBackground()
523: {
524: if (theme != null)
525: return theme.getSeparatorBackground();
526: return null;
527: }
528:
529:
534: public static ColorUIResource getSeparatorForeground()
535: {
536: if (theme != null)
537: return theme.getSeparatorForeground();
538: return null;
539: }
540:
541:
546: public static FontUIResource getSubTextFont()
547: {
548: if (theme != null)
549: return theme.getSubTextFont();
550: return null;
551: }
552:
553:
558: public static ColorUIResource getSystemTextColor()
559: {
560: if (theme != null)
561: return theme.getSystemTextColor();
562: return null;
563: }
564:
565:
570: public static FontUIResource getSystemTextFont()
571: {
572: if (theme != null)
573: return theme.getSystemTextFont();
574: return null;
575: }
576:
577:
582: public static ColorUIResource getTextHighlightColor()
583: {
584: if (theme != null)
585: return theme.getTextHighlightColor();
586: return null;
587: }
588:
589:
594: public static ColorUIResource getUserTextColor()
595: {
596: if (theme != null)
597: return theme.getUserTextColor();
598: return null;
599: }
600:
601:
606: public static FontUIResource getUserTextFont()
607: {
608: if (theme != null)
609: return theme.getUserTextFont();
610: return null;
611: }
612:
613:
618: public static ColorUIResource getWhite()
619: {
620: if (theme != null)
621: return theme.getWhite();
622: return null;
623: }
624:
625:
630: public static ColorUIResource getWindowBackground()
631: {
632: if (theme != null)
633: return theme.getWindowBackground();
634: return null;
635: }
636:
637:
642: public static ColorUIResource getWindowTitleBackground()
643: {
644: if (theme != null)
645: return theme.getWindowTitleBackground();
646: return null;
647: }
648:
649:
656: public static FontUIResource getWindowTitleFont()
657: {
658: if (theme != null)
659: return theme.getWindowTitleFont();
660: return null;
661: }
662:
663:
668: public static ColorUIResource getWindowTitleForeground()
669: {
670: if (theme != null)
671: return theme.getWindowTitleForeground();
672: return null;
673: }
674:
675:
681: public static ColorUIResource getWindowTitleInactiveBackground()
682: {
683: if (theme != null)
684: return theme.getWindowTitleInactiveBackground();
685: return null;
686: }
687:
688:
694: public static ColorUIResource getWindowTitleInactiveForeground()
695: {
696: if (theme != null)
697: return theme.getWindowTitleInactiveForeground();
698: return null;
699: }
700:
701:
713: public static void setCurrentTheme(MetalTheme theme)
714: {
715: if (theme == null)
716: throw new NullPointerException("Null 'theme' not permitted.");
717: MetalLookAndFeel.theme = theme;
718: }
719:
720:
776: protected void initClassDefaults(UIDefaults defaults)
777: {
778: super.initClassDefaults(defaults);
779:
780:
781: Object[] uiDefaults;
782:
783: uiDefaults = new Object[] {
784: "ButtonUI", "javax.swing.plaf.metal.MetalButtonUI",
785: "CheckBoxUI", "javax.swing.plaf.metal.MetalCheckBoxUI",
786: "ComboBoxUI", "javax.swing.plaf.metal.MetalComboBoxUI",
787: "DesktopIconUI", "javax.swing.plaf.metal.MetalDesktopIconUI",
788: "FileChooserUI", "javax.swing.plaf.metal.MetalFileChooserUI",
789: "InternalFrameUI", "javax.swing.plaf.metal.MetalInternalFrameUI",
790: "LabelUI", "javax.swing.plaf.metal.MetalLabelUI",
791: "MenuBarUI", "javax.swing.plaf.metal.MetalMenuBarUI",
792: "PopupMenuSeparatorUI",
793: "javax.swing.plaf.metal.MetalPopupMenuSeparatorUI",
794: "ProgressBarUI", "javax.swing.plaf.metal.MetalProgressBarUI",
795: "RadioButtonUI", "javax.swing.plaf.metal.MetalRadioButtonUI",
796: "RootPaneUI", "javax.swing.plaf.metal.MetalRootPaneUI",
797: "ScrollBarUI", "javax.swing.plaf.metal.MetalScrollBarUI",
798: "ScrollPaneUI", "javax.swing.plaf.metal.MetalScrollPaneUI",
799: "SeparatorUI", "javax.swing.plaf.metal.MetalSeparatorUI",
800: "SliderUI", "javax.swing.plaf.metal.MetalSliderUI",
801: "SplitPaneUI", "javax.swing.plaf.metal.MetalSplitPaneUI",
802: "TabbedPaneUI", "javax.swing.plaf.metal.MetalTabbedPaneUI",
803: "TextFieldUI", "javax.swing.plaf.metal.MetalTextFieldUI",
804: "ToggleButtonUI", "javax.swing.plaf.metal.MetalToggleButtonUI",
805: "ToolBarUI", "javax.swing.plaf.metal.MetalToolBarUI",
806: "ToolTipUI", "javax.swing.plaf.metal.MetalToolTipUI",
807: "TreeUI", "javax.swing.plaf.metal.MetalTreeUI",
808: };
809:
810: defaults.putDefaults(uiDefaults);
811: }
812:
813:
867: protected void initComponentDefaults(UIDefaults defaults)
868: {
869: super.initComponentDefaults(defaults);
870: Object[] myDefaults = new Object[] {
871: "Button.background", getControl(),
872: "Button.border", MetalBorders.getButtonBorder(),
873: "Button.darkShadow", getControlDarkShadow(),
874: "Button.disabledText", getInactiveControlTextColor(),
875: "Button.focus", getFocusColor(),
876: "Button.font", getControlTextFont(),
877: "Button.foreground", getControlTextColor(),
878: "Button.highlight", getControlHighlight(),
879: "Button.light", getControlHighlight(),
880: "Button.margin", new InsetsUIResource(2, 14, 2, 14),
881: "Button.select", getControlShadow(),
882: "Button.shadow", getControlShadow(),
883:
884: "CheckBox.background", getControl(),
885: "CheckBox.border", MetalBorders.getButtonBorder(),
886: "CheckBox.disabledText", getInactiveControlTextColor(),
887: "CheckBox.focus", getFocusColor(),
888: "CheckBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
889: "CheckBox.foreground", getControlTextColor(),
890: "CheckBox.icon",
891: new UIDefaults.ProxyLazyValue
892: ("javax.swing.plaf.metal.MetalCheckBoxIcon"),
893: "CheckBox.checkIcon",
894: new UIDefaults.ProxyLazyValue
895: ("javax.swing.plaf.metal.MetalCheckBoxIcon"),
896: "Checkbox.select", getControlShadow(),
897:
898: "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
899: "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(),
900: "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
901: "CheckBoxMenuItem.background", getMenuBackground(),
902: "CheckBoxMenuItem.borderPainted", new Boolean(true),
903: "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav",
904: "CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(),
905: "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(),
906: "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.BOLD, 12),
907: "CheckBoxMenuItem.foreground", getMenuForeground(),
908: "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(),
909: "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(),
910:
911: "ColorChooser.background", getControl(),
912: "ColorChooser.foreground", getControlTextColor(),
913: "ColorChooser.rgbBlueMnemonic", new Integer(0),
914: "ColorChooser.rgbGreenMnemonic", new Integer(0),
915: "ColorChooser.rgbRedMnemonic", new Integer(0),
916: "ColorChooser.swatchesDefaultRecentColor", getControl(),
917:
918: "ComboBox.background", getControl(),
919: "ComboBox.buttonBackground", getControl(),
920: "ComboBox.buttonDarkShadow", getControlDarkShadow(),
921: "ComboBox.buttonHighlight", getControlHighlight(),
922: "ComboBox.buttonShadow", getControlShadow(),
923: "ComboBox.disabledBackground", getControl(),
924: "ComboBox.disabledForeground", getInactiveSystemTextColor(),
925: "ComboBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
926: "ComboBox.foreground", getControlTextColor(),
927: "ComboBox.selectionBackground", getPrimaryControlShadow(),
928: "ComboBox.selectionForeground", getControlTextColor(),
929:
930: "Desktop.background", getDesktopColor(),
931:
932: "DesktopIcon.background", getControl(),
933: "DesktopIcon.foreground", getControlTextColor(),
934: "DesktopIcon.width", new Integer(160),
935: "DesktopIcon.border", MetalBorders.getDesktopIconBorder(),
936:
937: "EditorPane.background", getWindowBackground(),
938: "EditorPane.caretForeground", getUserTextColor(),
939: "EditorPane.font", new FontUIResource("Dialog", Font.BOLD, 12),
940: "EditorPane.foreground", getUserTextColor(),
941: "EditorPane.inactiveForeground", getInactiveSystemTextColor(),
942: "EditorPane.selectionBackground", getTextHighlightColor(),
943: "EditorPane.selectionForeground", getHighlightedTextColor(),
944:
945: "FormattedTextField.background", getWindowBackground(),
946: "FormattedTextField.border",
947: new BorderUIResource(MetalBorders.getTextFieldBorder()),
948: "FormattedTextField.caretForeground", getUserTextColor(),
949: "FormattedTextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
950: "FormattedTextField.foreground", getUserTextColor(),
951: "FormattedTextField.inactiveBackground", getControl(),
952: "FormattedTextField.inactiveForeground", getInactiveSystemTextColor(),
953: "FormattedTextField.selectionBackground", getTextHighlightColor(),
954: "FormattedTextField.selectionForeground", getHighlightedTextColor(),
955:
956: "FileChooser.upFolderIcon",
957: MetalIconFactory.getFileChooserUpFolderIcon(),
958: "FileChooser.listViewIcon",
959: MetalIconFactory.getFileChooserListViewIcon(),
960: "FileChooser.newFolderIcon",
961: MetalIconFactory.getFileChooserNewFolderIcon(),
962: "FileChooser.homeFolderIcon",
963: MetalIconFactory.getFileChooserHomeFolderIcon(),
964: "FileChooser.detailsViewIcon",
965: MetalIconFactory.getFileChooserDetailViewIcon(),
966: "FileChooser.fileNameLabelMnemonic", new Integer(78),
967: "FileChooser.filesOfTypeLabelMnemonic",new Integer(84),
968: "FileChooser.lookInLabelMnemonic", new Integer(73),
969: "FileView.computerIcon", MetalIconFactory.getTreeComputerIcon(),
970: "FileView.directoryIcon", MetalIconFactory.getTreeFolderIcon(),
971: "FileView.fileIcon", MetalIconFactory.getTreeLeafIcon(),
972: "FileView.floppyDriveIcon", MetalIconFactory.getTreeFloppyDriveIcon(),
973: "FileView.hardDriveIcon", MetalIconFactory.getTreeHardDriveIcon(),
974:
975: "InternalFrame.activeTitleBackground", getWindowTitleBackground(),
976: "InternalFrame.activeTitleForeground", getWindowTitleForeground(),
977: "InternalFrame.border", new MetalBorders.InternalFrameBorder(),
978: "InternalFrame.borderColor", getControl(),
979: "InternalFrame.borderDarkShadow", getControlDarkShadow(),
980: "InternalFrame.borderHighlight", getControlHighlight(),
981: "InternalFrame.borderLight", getControlHighlight(),
982: "InternalFrame.borderShadow", getControlShadow(),
983: "InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(),
984: "InternalFrame.closeIcon",
985: MetalIconFactory.getInternalFrameCloseIcon(16),
986: "InternalFrame.closeSound", "sounds/FrameClose.wav",
987: "InternalFrame.inactiveTitleBackground", getWindowTitleInactiveBackground(),
988: "InternalFrame.inactiveTitleForeground", getWindowTitleInactiveForeground(),
989: "InternalFrame.maximizeIcon",
990: MetalIconFactory.getInternalFrameMaximizeIcon(16),
991: "InternalFrame.maximizeSound", "sounds/FrameMaximize.wav",
992: "InternalFrame.iconifyIcon",
993: MetalIconFactory.getInternalFrameMinimizeIcon(16),
994: "InternalFrame.minimizeSound", "sounds/FrameMinimize.wav",
995: "InternalFrame.paletteBorder", new MetalBorders.PaletteBorder(),
996: "InternalFrame.paletteCloseIcon", new MetalIconFactory.PaletteCloseIcon(),
997: "InternalFrame.paletteTitleHeight", new Integer(11),
998: "InternalFrame.restoreDownSound", "sounds/FrameRestoreDown.wav",
999: "InternalFrame.restoreUpSound", "sounds/FrameRestoreUp.wav",
1000:
1001: "Label.background", getControl(),
1002: "Label.disabledForeground", getInactiveSystemTextColor(),
1003: "Label.disabledShadow", getControlShadow(),
1004: "Label.font", getControlTextFont(),
1005: "Label.foreground", getSystemTextColor(),
1006:
1007: "List.font", getControlTextFont(),
1008: "List.background", getWindowBackground(),
1009: "List.foreground", getUserTextColor(),
1010: "List.selectionBackground", getTextHighlightColor(),
1011: "List.selectionForeground", getHighlightedTextColor(),
1012: "List.focusCellHighlightBorder",
1013: new LineBorderUIResource(MetalLookAndFeel.getFocusColor()),
1014:
1015: "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
1016: "Menu.acceleratorForeground", getAcceleratorForeground(),
1017: "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
1018: "Menu.arrowIcon", MetalIconFactory.getMenuArrowIcon(),
1019: "Menu.background", getMenuBackground(),
1020: "Menu.border", new MetalBorders.MenuItemBorder(),
1021: "Menu.borderPainted", Boolean.TRUE,
1022: "MenuItem.commandSound", "sounds/MenuItemCommand.wav",
1023: "Menu.disabledForeground", getMenuDisabledForeground(),
1024: "Menu.font", getControlTextFont(),
1025: "Menu.foreground", getMenuForeground(),
1026: "Menu.selectionBackground", getMenuSelectedBackground(),
1027: "Menu.selectionForeground", getMenuSelectedForeground(),
1028: "Menu.submenuPopupOffsetX", new Integer(-4),
1029: "Menu.submenuPopupOffsetY", new Integer(-3),
1030:
1031: "MenuBar.background", getMenuBackground(),
1032: "MenuBar.border", new MetalBorders.MenuBarBorder(),
1033: "MenuBar.font", getControlTextFont(),
1034: "MenuBar.foreground", getMenuForeground(),
1035: "MenuBar.highlight", getControlHighlight(),
1036: "MenuBar.shadow", getControlShadow(),
1037:
1038: "MenuItem.acceleratorDelimiter", "-",
1039: "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
1040: "MenuItem.acceleratorForeground", getAcceleratorForeground(),
1041: "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
1042: "MenuItem.arrowIcon", MetalIconFactory.getMenuItemArrowIcon(),
1043: "MenuItem.background", getMenuBackground(),
1044: "MenuItem.border", new MetalBorders.MenuItemBorder(),
1045: "MenuItem.borderPainted", Boolean.TRUE,
1046: "MenuItem.disabledForeground", getMenuDisabledForeground(),
1047: "MenuItem.font", getControlTextFont(),
1048: "MenuItem.foreground", getMenuForeground(),
1049: "MenuItem.selectionBackground", getMenuSelectedBackground(),
1050: "MenuItem.selectionForeground", getMenuSelectedForeground(),
1051:
1052: "OptionPane.background", getControl(),
1053: "OptionPane.errorSound", "sounds/OptionPaneError.wav",
1054: "OptionPane.informationSound", "sounds/OptionPaneInformation.wav",
1055: "OptionPane.questionSound", "sounds/OptionPaneQuestion.wav",
1056: "OptionPane.warningSound", "sounds/OptionPaneWarning.wav",
1057: "OptionPane.errorDialog.border.background", new ColorUIResource(153, 51, 51),
1058: "OptionPane.errorDialog.titlePane.background", new ColorUIResource(255, 153, 153),
1059: "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(51, 0, 0),
1060: "OptionPane.errorDialog.titlePane.shadow", new ColorUIResource(204, 102, 102),
1061: "OptionPane.foreground", getControlTextColor(),
1062: "OptionPane.messageForeground", getControlTextColor(),
1063: "OptionPane.questionDialog.border.background", new ColorUIResource(51, 102, 51),
1064: "OptionPane.questionDialog.titlePane.background", new ColorUIResource(153, 204, 153),
1065: "OptionPane.questionDialog.titlePane.foreground", new ColorUIResource(0, 51, 0),
1066: "OptionPane.questionDialog.titlePane.shadow", new ColorUIResource(102, 153, 102),
1067: "OptionPane.warningDialog.border.background", new ColorUIResource(153, 102, 51),
1068: "OptionPane.warningDialog.titlePane.background", new ColorUIResource(255, 204, 153),
1069: "OptionPane.warningDialog.titlePane.foreground", new ColorUIResource(102, 51, 0),
1070: "OptionPane.warningDialog.titlePane.shadow", new ColorUIResource(204, 153, 102),
1071:
1072: "Panel.background", getControl(),
1073: "Panel.foreground", getUserTextColor(),
1074:
1075: "PasswordField.background", getWindowBackground(),
1076: "PasswordField.border",
1077: new BorderUIResource(MetalBorders.getTextFieldBorder()),
1078: "PasswordField.caretForeground", getUserTextColor(),
1079: "PasswordField.foreground", getUserTextColor(),
1080: "PasswordField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1081: "PasswordField.inactiveBackground", getControl(),
1082: "PasswordField.inactiveForeground", getInactiveSystemTextColor(),
1083: "PasswordField.selectionBackground", getTextHighlightColor(),
1084: "PasswordField.selectionForeground", getHighlightedTextColor(),
1085:
1086: "PopupMenu.background", getMenuBackground(),
1087: "PopupMenu.border", new MetalBorders.PopupMenuBorder(),
1088: "PopupMenu.font", new FontUIResource("Dialog", Font.BOLD, 12),
1089: "PopupMenu.foreground", getMenuForeground(),
1090: "PopupMenu.popupSound", "sounds/PopupMenuPopup.wav",
1091:
1092: "ProgressBar.background", getControl(),
1093: "ProgressBar.border", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
1094: "ProgressBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
1095: "ProgressBar.foreground", getPrimaryControlShadow(),
1096: "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(),
1097: "ProgressBar.selectionForeground", getControl(),
1098:
1099: "RadioButton.background", getControl(),
1100: "RadioButton.darkShadow", getControlDarkShadow(),
1101: "RadioButton.disabledText", getInactiveControlTextColor(),
1102: "RadioButton.icon",
1103: new UIDefaults.LazyValue()
1104: {
1105: public Object createValue(UIDefaults def)
1106: {
1107: return MetalIconFactory.getRadioButtonIcon();
1108: }
1109: },
1110: "RadioButton.focus", MetalLookAndFeel.getFocusColor(),
1111: "RadioButton.font", MetalLookAndFeel.getControlTextFont(),
1112: "RadioButton.foreground", getControlTextColor(),
1113: "RadioButton.highlight", getControlHighlight(),
1114: "RadioButton.light", getControlHighlight(),
1115: "RadioButton.select", getControlShadow(),
1116: "RadioButton.shadow", getControlShadow(),
1117:
1118: "RadioButtonMenuItem.acceleratorFont", new Font("Dialog", Font.PLAIN, 10),
1119: "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(),
1120: "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
1121: "RadioButtonMenuItem.background", getMenuBackground(),
1122: "RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(),
1123: "RadioButtonMenuItem.borderPainted", Boolean.TRUE,
1124: "RadioButtonMenuItem.checkIcon",
1125: MetalIconFactory.getRadioButtonMenuItemIcon(),
1126: "RadioButtonMenuItem.commandSound", "sounds/MenuItemCommand.wav",
1127: "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(),
1128: "RadioButtonMenuItem.font", MetalLookAndFeel.getControlTextFont(),
1129: "RadioButtonMenuItem.foreground", getMenuForeground(),
1130: "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
1131: "RadioButtonMenuItem.selectionBackground",
1132: MetalLookAndFeel.getMenuSelectedBackground(),
1133: "RadioButtonMenuItem.selectionForeground",
1134: MetalLookAndFeel.getMenuSelectedForeground(),
1135:
1136: "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
1137: "ScrollBar.background", getControl(),
1138: "ScrollBar.darkShadow", getControlDarkShadow(),
1139: "ScrollBar.foreground", getControl(),
1140: "ScrollBar.highlight", getControlHighlight(),
1141: "ScrollBar.shadow", getControlShadow(),
1142: "ScrollBar.thumb", getPrimaryControlShadow(),
1143: "ScrollBar.thumbDarkShadow", getControlDarkShadow(),
1144: "ScrollBar.thumbHighlight", getPrimaryControl(),
1145: "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(),
1146: "ScrollBar.track", getControl(),
1147: "ScrollBar.trackHighlight", getControlDarkShadow(),
1148: "ScrollBar.width", new Integer(17),
1149:
1150: "ScrollPane.background", getControl(),
1151: "ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
1152: "ScrollPane.foreground", getControlTextColor(),
1153:
1154: "Separator.background", getSeparatorBackground(),
1155: "Separator.foreground", getSeparatorForeground(),
1156: "Separator.highlight", getControlHighlight(),
1157: "Separator.shadow", getControlShadow(),
1158:
1159: "Slider.background", getControl(),
1160: "Slider.focus", getFocusColor(),
1161: "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0),
1162: "Slider.foreground", getPrimaryControlShadow(),
1163: "Slider.highlight", getControlHighlight(),
1164: "Slider.horizontalThumbIcon",
1165: MetalIconFactory.getHorizontalSliderThumbIcon(),
1166: "Slider.majorTickLength", new Integer(6),
1167: "Slider.shadow", getControlShadow(),
1168: "Slider.trackWidth", new Integer(7),
1169: "Slider.verticalThumbIcon",
1170: MetalIconFactory.getVerticalSliderThumbIcon(),
1171:
1172: "Spinner.arrowButtonInsets", new InsetsUIResource(0, 0, 0, 0),
1173: "Spinner.background", getControl(),
1174: "Spinner.font", new FontUIResource("Dialog", Font.BOLD, 12),
1175: "Spinner.foreground", getControl(),
1176:
1177: "SplitPane.background", getControl(),
1178: "SplitPane.darkShadow", getControlDarkShadow(),
1179: "SplitPane.dividerFocusColor", getPrimaryControl(),
1180: "SplitPane.dividerSize", new Integer(10),
1181: "SplitPane.highlight", getControlHighlight(),
1182: "SplitPane.shadow", getControlShadow(),
1183:
1184: "SplitPaneDivider.draggingColor", Color.DARK_GRAY,
1185:
1186: "TabbedPane.background", getControlShadow(),
1187: "TabbedPane.darkShadow", getControlDarkShadow(),
1188: "TabbedPane.focus", getPrimaryControlDarkShadow(),
1189: "TabbedPane.font", new FontUIResource("Dialog", Font.BOLD, 12),
1190: "TabbedPane.foreground", getControlTextColor(),
1191: "TabbedPane.highlight", getControlHighlight(),
1192: "TabbedPane.light", getControl(),
1193: "TabbedPane.selected", getControl(),
1194: "TabbedPane.selectHighlight", getControlHighlight(),
1195: "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1),
1196: "TabbedPane.shadow", getControlShadow(),
1197: "TabbedPane.tabAreaBackground", getControl(),
1198: "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6),
1199: "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
1200:
1201: "Table.background", getWindowBackground(),
1202: "Table.focusCellBackground", getWindowBackground(),
1203: "Table.focusCellForeground", getControlTextColor(),
1204: "Table.foreground", getControlTextColor(),
1205: "Table.focusCellHighlightBorder",
1206: new BorderUIResource.LineBorderUIResource(getControlShadow()),
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.font", new FontUIResource("Dialog", Font.BOLD, 12),
1248: "TitledBorder.titleColor", getSystemTextColor(),
1249:
1250: "ToggleButton.background", getControl(),
1251: "ToggleButton.border", MetalBorders.getToggleButtonBorder(),
1252: "ToggleButton.darkShadow", getControlDarkShadow(),
1253: "ToggleButton.disabledText", getInactiveControlTextColor(),
1254: "ToggleButton.focus", getFocusColor(),
1255: "ToggleButton.font", getControlTextFont(),
1256: "ToggleButton.foreground", getControlTextColor(),
1257: "ToggleButton.highlight", getControlHighlight(),
1258: "ToggleButton.light", getControlHighlight(),
1259: "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
1260: "ToggleButton.select", getControlShadow(),
1261: "ToggleButton.shadow", getControlShadow(),
1262:
1263: "ToolBar.background", getMenuBackground(),
1264: "ToolBar.darkShadow", getControlDarkShadow(),
1265: "ToolBar.dockingBackground", getMenuBackground(),
1266: "ToolBar.dockingForeground", getPrimaryControlDarkShadow(),
1267: "ToolBar.floatingBackground", getMenuBackground(),
1268: "ToolBar.floatingForeground", getPrimaryControl(),
1269: "ToolBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
1270: "ToolBar.foreground", getMenuForeground(),
1271: "ToolBar.highlight", getControlHighlight(),
1272: "ToolBar.light", getControlHighlight(),
1273: "ToolBar.shadow", getControlShadow(),
1274: "ToolBar.border", new MetalBorders.ToolBarBorder(),
1275:
1276: "ToolTip.background", getPrimaryControl(),
1277: "ToolTip.backgroundInactive", getControl(),
1278: "ToolTip.border", new BorderUIResource.LineBorderUIResource(getPrimaryControlDarkShadow(), 1),
1279: "ToolTip.borderInactive", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
1280: "ToolTip.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1281: "ToolTip.foreground", getPrimaryControlInfo(),
1282: "ToolTip.foregroundInactive", getControlDarkShadow(),
1283: "ToolTip.hideAccelerator", Boolean.FALSE,
1284:
1285: "Tree.background", getWindowBackground(),
1286: "Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(),
1287: "Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true),
1288: "Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false),
1289: "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1290: "Tree.foreground", getUserTextColor(),
1291: "Tree.hash", getPrimaryControl(),
1292: "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
1293: "Tree.leftChildIndent", new Integer(7),
1294: "Tree.line", getPrimaryControl(),
1295: "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
1296: "Tree.rightChildIndent", new Integer(13),
1297: "Tree.rowHeight", new Integer(0),
1298: "Tree.scrollsOnExpand", Boolean.TRUE,
1299: "Tree.selectionBackground", getTextHighlightColor(),
1300: "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)),
1301: "Tree.selectionBorderColor", getFocusColor(),
1302: "Tree.selectionForeground", getHighlightedTextColor(),
1303: "Tree.textBackground", getWindowBackground(),
1304: "Tree.textForeground", getUserTextColor(),
1305:
1306: "Viewport.background", getControl(),
1307: "Viewport.foreground", getUserTextColor()
1308: };
1309: defaults.putDefaults(myDefaults);
1310: }
1311:
1312:
1325: protected void initSystemColorDefaults(UIDefaults defaults)
1326: {
1327: super.initSystemColorDefaults(defaults);
1328: Object[] uiDefaults;
1329: uiDefaults = new Object[] {
1330: "control", new ColorUIResource(getControl()),
1331: "desktop", new ColorUIResource(getDesktopColor())
1332: };
1333: defaults.putDefaults(uiDefaults);
1334: }
1335:
1336:
1341: public static MetalTheme getCurrentTheme()
1342: {
1343: return theme;
1344: }
1345: }