1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44:
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54:
55:
56:
60: public class MetalLookAndFeel extends BasicLookAndFeel
61: {
62: private static final long serialVersionUID = 6680646159193457980L;
63:
64:
65: private static MetalTheme theme;
66:
67:
68: private UIDefaults LAF_defaults;
69:
70:
73: public MetalLookAndFeel()
74: {
75: if (theme == null)
76: createDefaultTheme();
77: }
78:
79:
82: protected void createDefaultTheme()
83: {
84: setCurrentTheme(new DefaultMetalTheme());
85: }
86:
87:
94: public boolean isNativeLookAndFeel()
95: {
96: return false;
97: }
98:
99:
105: public boolean isSupportedLookAndFeel()
106: {
107: return true;
108: }
109:
110:
116: public String getDescription()
117: {
118: return "Metal look and feel";
119: }
120:
121:
126: public String getID()
127: {
128: return "MetalLookAndFeel";
129: }
130:
131:
136: public String getName()
137: {
138: return "MetalLookAndFeel";
139: }
140:
141: public UIDefaults getDefaults()
142: {
143: if (LAF_defaults == null)
144: {
145: LAF_defaults = super.getDefaults();
146:
147:
148: theme.addCustomEntriesToTable(LAF_defaults);
149: }
150:
151:
152: return LAF_defaults;
153: }
154:
155:
160: public static ColorUIResource getAcceleratorForeground()
161: {
162: return theme.getAcceleratorForeground();
163: }
164:
165:
171: public static ColorUIResource getAcceleratorSelectedForeground()
172: {
173: return theme.getAcceleratorSelectedForeground();
174: }
175:
176:
181: public static ColorUIResource getBlack()
182: {
183: return theme.getBlack();
184: }
185:
186:
191: public static ColorUIResource getControl()
192: {
193: return theme.getControl();
194: }
195:
196:
202: public static ColorUIResource getControlDarkShadow()
203: {
204: return theme.getControlDarkShadow();
205: }
206:
207:
212: public static ColorUIResource getControlDisabled()
213: {
214: return theme.getControlDisabled();
215: }
216:
217:
223: public static ColorUIResource getControlHighlight()
224: {
225: return theme.getControlHighlight();
226: }
227:
228:
234: public static ColorUIResource getControlInfo()
235: {
236: return theme.getControlInfo();
237: }
238:
239:
245: public static ColorUIResource getControlShadow()
246: {
247: return theme.getControlShadow();
248: }
249:
250:
255: public static ColorUIResource getControlTextColor()
256: {
257: return theme.getControlTextColor();
258: }
259:
260:
265: public static FontUIResource getControlTextFont()
266: {
267: return theme.getControlTextFont();
268: }
269:
270:
276: public static ColorUIResource getDesktopColor()
277: {
278: return theme.getDesktopColor();
279: }
280:
281:
287: public static ColorUIResource getFocusColor()
288: {
289: return theme.getFocusColor();
290: }
291:
292:
298: public static ColorUIResource getHighlightedTextColor()
299: {
300: return theme.getHighlightedTextColor();
301: }
302:
303:
309: public static ColorUIResource getInactiveControlTextColor()
310: {
311: return theme.getInactiveControlTextColor();
312: }
313:
314:
320: public static ColorUIResource getInactiveSystemTextColor()
321: {
322: return theme.getInactiveSystemTextColor();
323: }
324:
325:
332: public static ColorUIResource getMenuBackground()
333: {
334: return theme.getMenuBackground();
335: }
336:
337:
345: public static ColorUIResource getMenuDisabledForeground()
346: {
347: return theme.getMenuDisabledForeground();
348: }
349:
350:
358: public static ColorUIResource getMenuForeground()
359: {
360: return theme.getMenuForeground();
361: }
362:
363:
371: public static ColorUIResource getMenuSelectedBackground()
372: {
373: return theme.getMenuSelectedBackground();
374: }
375:
376:
384: public static ColorUIResource getMenuSelectedForeground()
385: {
386: return theme.getMenuSelectedForeground();
387: }
388:
389:
394: public static FontUIResource getMenuTextFont()
395: {
396: return theme.getMenuTextFont();
397: }
398:
399:
404: public static ColorUIResource getPrimaryControl()
405: {
406: return theme.getPrimaryControl();
407: }
408:
409:
415: public static ColorUIResource getPrimaryControlDarkShadow()
416: {
417: return theme.getPrimaryControlDarkShadow();
418: }
419:
420:
426: public static ColorUIResource getPrimaryControlHighlight()
427: {
428: return theme.getPrimaryControlHighlight();
429: }
430:
431:
437: public static ColorUIResource getPrimaryControlInfo()
438: {
439: return theme.getPrimaryControlInfo();
440: }
441:
442:
448: public static ColorUIResource getPrimaryControlShadow()
449: {
450: return theme.getPrimaryControlShadow();
451: }
452:
453:
458: public static ColorUIResource getSeparatorBackground()
459: {
460: return theme.getSeparatorBackground();
461: }
462:
463:
468: public static ColorUIResource getSeparatorForeground()
469: {
470: return theme.getSeparatorForeground();
471: }
472:
473:
478: public static FontUIResource getSubTextFont()
479: {
480: return theme.getSubTextFont();
481: }
482:
483:
488: public static ColorUIResource getSystemTextColor()
489: {
490: return theme.getSystemTextColor();
491: }
492:
493:
498: public static FontUIResource getSystemTextFont()
499: {
500: return theme.getSystemTextFont();
501: }
502:
503:
508: public static ColorUIResource getTextHighlightColor()
509: {
510: return theme.getTextHighlightColor();
511: }
512:
513:
518: public static ColorUIResource getUserTextColor()
519: {
520: return theme.getUserTextColor();
521: }
522:
523:
528: public static FontUIResource getUserTextFont()
529: {
530: return theme.getUserTextFont();
531: }
532:
533:
538: public static ColorUIResource getWhite()
539: {
540: return theme.getWhite();
541: }
542:
543:
548: public static ColorUIResource getWindowBackground()
549: {
550: return theme.getWindowBackground();
551: }
552:
553:
558: public static ColorUIResource getWindowTitleBackground()
559: {
560: return theme.getWindowTitleBackground();
561: }
562:
563:
570: public static FontUIResource getWindowTitleFont()
571: {
572: return theme.getWindowTitleFont();
573: }
574:
575:
580: public static ColorUIResource getWindowTitleForeground()
581: {
582: return theme.getWindowTitleForeground();
583: }
584:
585:
591: public static ColorUIResource getWindowTitleInactiveBackground()
592: {
593: return theme.getWindowTitleInactiveBackground();
594: }
595:
596:
602: public static ColorUIResource getWindowTitleInactiveForeground()
603: {
604: return theme.getWindowTitleInactiveForeground();
605: }
606:
607:
619: public static void setCurrentTheme(MetalTheme theme)
620: {
621: if (theme == null)
622: throw new NullPointerException("Null 'theme' not permitted.");
623: MetalLookAndFeel.theme = theme;
624: }
625:
626:
682: protected void initClassDefaults(UIDefaults defaults)
683: {
684: super.initClassDefaults(defaults);
685:
686:
687: Object[] uiDefaults;
688:
689: uiDefaults = new Object[] {
690: "ButtonUI", "javax.swing.plaf.metal.MetalButtonUI",
691: "CheckBoxUI", "javax.swing.plaf.metal.MetalCheckBoxUI",
692: "ComboBoxUI", "javax.swing.plaf.metal.MetalComboBoxUI",
693: "DesktopIconUI", "javax.swing.plaf.metal.MetalDesktopIconUI",
694: "InternalFrameUI", "javax.swing.plaf.metal.MetalInternalFrameUI",
695: "LabelUI", "javax.swing.plaf.metal.MetalLabelUI",
696: "MenuBarUI", "javax.swing.plaf.metal.MetalMenuBarUI",
697: "PopupMenuSeparatorUI",
698: "javax.swing.plaf.metal.MetalPopupMenuSeparatorUI",
699: "ProgressBarUI", "javax.swing.plaf.metal.MetalProgressBarUI",
700: "RadioButtonUI", "javax.swing.plaf.metal.MetalRadioButtonUI",
701: "RootPaneUI", "javax.swing.plaf.metal.MetalRootPaneUI",
702: "ScrollBarUI", "javax.swing.plaf.metal.MetalScrollBarUI",
703: "ScrollPaneUI", "javax.swing.plaf.metal.MetalScrollPaneUI",
704: "SeparatorUI", "javax.swing.plaf.metal.MetalSeparatorUI",
705: "SliderUI", "javax.swing.plaf.metal.MetalSliderUI",
706: "SplitPaneUI", "javax.swing.plaf.metal.MetalSplitPaneUI",
707: "TabbedPaneUI", "javax.swing.plaf.metal.MetalTabbedPaneUI",
708: "TextFieldUI", "javax.swing.plaf.metal.MetalTextFieldUI",
709: "ToggleButtonUI", "javax.swing.plaf.metal.MetalToggleButtonUI",
710: "ToolBarUI", "javax.swing.plaf.metal.MetalToolBarUI",
711: "ToolTipUI", "javax.swing.plaf.metal.MetalToolTipUI",
712: "TreeUI", "javax.swing.plaf.metal.MetalTreeUI",
713: };
714:
715: defaults.putDefaults(uiDefaults);
716: }
717:
718:
772: protected void initComponentDefaults(UIDefaults defaults)
773: {
774: super.initComponentDefaults(defaults);
775: Object[] myDefaults = new Object[] {
776: "Button.background", getControl(),
777: "Button.border", MetalBorders.getButtonBorder(),
778: "Button.darkShadow", getControlDarkShadow(),
779: "Button.disabledText", getInactiveControlTextColor(),
780: "Button.focus", getFocusColor(),
781: "Button.font", getControlTextFont(),
782: "Button.foreground", getControlTextColor(),
783: "Button.highlight", getControlHighlight(),
784: "Button.light", getControlHighlight(),
785: "Button.margin", new InsetsUIResource(2, 14, 2, 14),
786: "Button.select", getControlShadow(),
787: "Button.shadow", getControlShadow(),
788:
789: "CheckBox.background", getControl(),
790: "CheckBox.border", MetalBorders.getButtonBorder(),
791: "CheckBox.disabledText", getInactiveControlTextColor(),
792: "CheckBox.focus", getFocusColor(),
793: "CheckBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
794: "CheckBox.foreground", getControlTextColor(),
795: "CheckBox.icon",
796: new UIDefaults.ProxyLazyValue
797: ("javax.swing.plaf.metal.MetalCheckBoxIcon"),
798: "CheckBox.checkIcon",
799: new UIDefaults.ProxyLazyValue
800: ("javax.swing.plaf.metal.MetalCheckBoxIcon"),
801: "Checkbox.select", getControlShadow(),
802:
803: "CheckBoxMenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
804: "CheckBoxMenuItem.acceleratorForeground", getAcceleratorForeground(),
805: "CheckBoxMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
806: "CheckBoxMenuItem.background", getMenuBackground(),
807: "CheckBoxMenuItem.borderPainted", new Boolean(true),
808: "CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav",
809: "CheckBoxMenuItem.checkIcon", MetalIconFactory.getCheckBoxMenuItemIcon(),
810: "CheckBoxMenuItem.disabledForeground", getMenuDisabledForeground(),
811: "CheckBoxMenuItem.font", new FontUIResource("Dialog", Font.BOLD, 12),
812: "CheckBoxMenuItem.foreground", getMenuForeground(),
813: "CheckBoxMenuItem.selectionBackground", getMenuSelectedBackground(),
814: "CheckBoxMenuItem.selectionForeground", getMenuSelectedForeground(),
815:
816: "ColorChooser.background", getControl(),
817: "ColorChooser.foreground", getControlTextColor(),
818: "ColorChooser.rgbBlueMnemonic", new Integer(0),
819: "ColorChooser.rgbGreenMnemonic", new Integer(0),
820: "ColorChooser.rgbRedMnemonic", new Integer(0),
821: "ColorChooser.swatchesDefaultRecentColor", getControl(),
822:
823: "ComboBox.background", getControl(),
824: "ComboBox.buttonBackground", getControl(),
825: "ComboBox.buttonDarkShadow", getControlDarkShadow(),
826: "ComboBox.buttonHighlight", getControlHighlight(),
827: "ComboBox.buttonShadow", getControlShadow(),
828: "ComboBox.disabledBackground", getControl(),
829: "ComboBox.disabledForeground", getInactiveSystemTextColor(),
830: "ComboBox.font", new FontUIResource("Dialog", Font.BOLD, 12),
831: "ComboBox.foreground", getControlTextColor(),
832: "ComboBox.selectionBackground", getPrimaryControlShadow(),
833: "ComboBox.selectionForeground", getControlTextColor(),
834:
835: "Desktop.background", getDesktopColor(),
836:
837: "DesktopIcon.background", getControl(),
838: "DesktopIcon.foreground", getControlTextColor(),
839: "DesktopIcon.width", new Integer(160),
840: "DesktopIcon.border", MetalBorders.getDesktopIconBorder(),
841:
842: "EditorPane.background", getWindowBackground(),
843: "EditorPane.caretForeground", getUserTextColor(),
844: "EditorPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
845: "EditorPane.foreground", getUserTextColor(),
846: "EditorPane.inactiveForeground", getInactiveSystemTextColor(),
847: "EditorPane.selectionBackground", getTextHighlightColor(),
848: "EditorPane.selectionForeground", getHighlightedTextColor(),
849:
850: "FormattedTextField.background", getWindowBackground(),
851: "FormattedTextField.border",
852: new BorderUIResource(MetalBorders.getTextFieldBorder()),
853: "FormattedTextField.caretForeground", getUserTextColor(),
854: "FormattedTextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
855: "FormattedTextField.foreground", getUserTextColor(),
856: "FormattedTextField.inactiveBackground", getControl(),
857: "FormattedTextField.inactiveForeground", getInactiveSystemTextColor(),
858: "FormattedTextField.selectionBackground", getTextHighlightColor(),
859: "FormattedTextField.selectionForeground", getHighlightedTextColor(),
860:
861: "FileView.computerIcon", MetalIconFactory.getTreeComputerIcon(),
862: "FileView.directoryIcon", MetalIconFactory.getTreeFolderIcon(),
863: "FileView.fileIcon", MetalIconFactory.getTreeLeafIcon(),
864: "FileView.floppyDriveIcon", MetalIconFactory.getTreeFloppyDriveIcon(),
865: "FileView.hardDriveIcon", MetalIconFactory.getTreeHardDriveIcon(),
866:
867: "InternalFrame.activeTitleBackground", getWindowTitleBackground(),
868: "InternalFrame.activeTitleForeground", getWindowTitleForeground(),
869: "InternalFrame.border", new MetalBorders.InternalFrameBorder(),
870: "InternalFrame.borderColor", getControl(),
871: "InternalFrame.borderDarkShadow", getControlDarkShadow(),
872: "InternalFrame.borderHighlight", getControlHighlight(),
873: "InternalFrame.borderLight", getControlHighlight(),
874: "InternalFrame.borderShadow", getControlShadow(),
875: "InternalFrame.icon", MetalIconFactory.getInternalFrameDefaultMenuIcon(),
876: "InternalFrame.closeIcon",
877: MetalIconFactory.getInternalFrameCloseIcon(16),
878: "InternalFrame.inactiveTitleBackground", getWindowTitleInactiveBackground(),
879: "InternalFrame.inactiveTitleForeground", getWindowTitleInactiveForeground(),
880: "InternalFrame.maximizeIcon",
881: MetalIconFactory.getInternalFrameMaximizeIcon(16),
882: "InternalFrame.iconifyIcon",
883: MetalIconFactory.getInternalFrameMinimizeIcon(16),
884: "InternalFrame.paletteBorder", new MetalBorders.PaletteBorder(),
885: "InternalFrame.paletteCloseIcon", new MetalIconFactory.PaletteCloseIcon(),
886: "InternalFrame.paletteTitleHeight", new Integer(11),
887:
888: "Label.background", getControl(),
889: "Label.disabledForeground", getInactiveSystemTextColor(),
890: "Label.disabledShadow", getControlShadow(),
891: "Label.font", getControlTextFont(),
892: "Label.foreground", getSystemTextColor(),
893:
894: "List.font", getControlTextFont(),
895: "List.background", getWindowBackground(),
896: "List.foreground", getUserTextColor(),
897: "List.selectionBackground", getTextHighlightColor(),
898: "List.selectionForeground", getHighlightedTextColor(),
899: "List.focusCellHighlightBorder",
900: new LineBorderUIResource(MetalLookAndFeel.getFocusColor()),
901:
902: "Menu.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
903: "Menu.acceleratorForeground", getAcceleratorForeground(),
904: "Menu.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
905: "Menu.background", getMenuBackground(),
906: "Menu.border", new MetalBorders.MenuItemBorder(),
907: "Menu.borderPainted", Boolean.TRUE,
908: "Menu.disabledForeground", getMenuDisabledForeground(),
909: "Menu.font", getControlTextFont(),
910: "Menu.foreground", getMenuForeground(),
911: "Menu.selectionBackground", getMenuSelectedBackground(),
912: "Menu.selectionForeground", getMenuSelectedForeground(),
913:
914: "MenuBar.background", getMenuBackground(),
915: "MenuBar.border", new MetalBorders.MenuBarBorder(),
916: "MenuBar.font", getControlTextFont(),
917: "MenuBar.foreground", getMenuForeground(),
918: "MenuBar.highlight", getControlHighlight(),
919: "MenuBar.shadow", getControlShadow(),
920:
921: "MenuItem.acceleratorFont", new FontUIResource("Dialog", Font.PLAIN, 10),
922: "MenuItem.acceleratorForeground", getAcceleratorForeground(),
923: "MenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
924: "MenuItem.background", getMenuBackground(),
925: "MenuItem.border", new MetalBorders.MenuItemBorder(),
926: "MenuItem.disabledForeground", getMenuDisabledForeground(),
927: "MenuItem.font", getControlTextFont(),
928: "MenuItem.foreground", getMenuForeground(),
929: "MenuItem.selectionBackground", getMenuSelectedBackground(),
930: "MenuItem.selectionForeground", getMenuSelectedForeground(),
931:
932: "OptionPane.background", getControl(),
933: "OptionPane.errorDialog.border.background", new ColorUIResource(153, 51, 51),
934: "OptionPane.errorDialog.titlePane.background", new ColorUIResource(255, 153, 153),
935: "OptionPane.errorDialog.titlePane.foreground", new ColorUIResource(51, 0, 0),
936: "OptionPane.errorDialog.titlePane.shadow", new ColorUIResource(204, 102, 102),
937: "OptionPane.foreground", getControlTextColor(),
938: "OptionPane.messageForeground", getControlTextColor(),
939: "OptionPane.questionDialog.border.background", new ColorUIResource(51, 102, 51),
940: "OptionPane.questionDialog.titlePane.background", new ColorUIResource(153, 204, 153),
941: "OptionPane.questionDialog.titlePane.foreground", new ColorUIResource(0, 51, 0),
942: "OptionPane.questionDialog.titlePane.shadow", new ColorUIResource(102, 153, 102),
943: "OptionPane.warningDialog.border.background", new ColorUIResource(153, 102, 51),
944: "OptionPane.warningDialog.titlePane.background", new ColorUIResource(255, 204, 153),
945: "OptionPane.warningDialog.titlePane.foreground", new ColorUIResource(102, 51, 0),
946: "OptionPane.warningDialog.titlePane.shadow", new ColorUIResource(204, 153, 102),
947:
948: "Panel.background", getControl(),
949: "Panel.foreground", getUserTextColor(),
950:
951: "PasswordField.background", getWindowBackground(),
952: "PasswordField.border",
953: new BorderUIResource(MetalBorders.getTextFieldBorder()),
954: "PasswordField.caretForeground", getUserTextColor(),
955: "PasswordField.foreground", getUserTextColor(),
956: "PasswordField.inactiveBackground", getControl(),
957: "PasswordField.inactiveForeground", getInactiveSystemTextColor(),
958: "PasswordField.selectionBackground", getTextHighlightColor(),
959: "PasswordField.selectionForeground", getHighlightedTextColor(),
960:
961: "PopupMenu.background", getMenuBackground(),
962: "PopupMenu.border", new MetalBorders.PopupMenuBorder(),
963: "PopupMenu.font", new FontUIResource("Dialog", Font.BOLD, 12),
964: "PopupMenu.foreground", getMenuForeground(),
965:
966: "ProgressBar.background", getControl(),
967: "ProgressBar.border", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
968: "ProgressBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
969: "ProgressBar.foreground", getPrimaryControlShadow(),
970: "ProgressBar.selectionBackground", getPrimaryControlDarkShadow(),
971: "ProgressBar.selectionForeground", getControl(),
972:
973: "RadioButton.background", getControl(),
974: "RadioButton.darkShadow", getControlDarkShadow(),
975: "RadioButton.disabledText", getInactiveControlTextColor(),
976: "RadioButton.icon",
977: new UIDefaults.LazyValue()
978: {
979: public Object createValue(UIDefaults def)
980: {
981: return MetalIconFactory.getRadioButtonIcon();
982: }
983: },
984: "RadioButton.focus", MetalLookAndFeel.getFocusColor(),
985: "RadioButton.font", MetalLookAndFeel.getControlTextFont(),
986: "RadioButton.foreground", getControlTextColor(),
987: "RadioButton.highlight", getControlHighlight(),
988: "RadioButton.light", getControlHighlight(),
989: "RadioButton.select", getControlShadow(),
990: "RadioButton.shadow", getControlShadow(),
991:
992: "RadioButtonMenuItem.acceleratorFont", new Font("Dialog", Font.PLAIN, 10),
993: "RadioButtonMenuItem.acceleratorForeground", getAcceleratorForeground(),
994: "RadioButtonMenuItem.acceleratorSelectionForeground", getAcceleratorSelectedForeground(),
995: "RadioButtonMenuItem.background", getMenuBackground(),
996: "RadioButtonMenuItem.border", new MetalBorders.MenuItemBorder(),
997: "RadioButtonMenuItem.borderPainted", Boolean.TRUE,
998: "RadioButtonMenuItem.checkIcon",
999: MetalIconFactory.getRadioButtonMenuItemIcon(),
1000: "RadioButtonMenuItem.disabledForeground", getMenuDisabledForeground(),
1001: "RadioButtonMenuItem.font", MetalLookAndFeel.getControlTextFont(),
1002: "RadioButtonMenuItem.foreground", getMenuForeground(),
1003: "RadioButtonMenuItem.margin", new InsetsUIResource(2, 2, 2, 2),
1004: "RadioButtonMenuItem.selectionBackground",
1005: MetalLookAndFeel.getMenuSelectedBackground(),
1006: "RadioButtonMenuItem.selectionForeground",
1007: MetalLookAndFeel.getMenuSelectedForeground(),
1008:
1009: "ScrollBar.background", getControl(),
1010: "ScrollBar.darkShadow", getControlDarkShadow(),
1011: "ScrollBar.foreground", getControl(),
1012: "ScrollBar.highlight", getControlHighlight(),
1013: "ScrollBar.shadow", getControlShadow(),
1014: "ScrollBar.thumb", getPrimaryControlShadow(),
1015: "ScrollBar.thumbDarkShadow", getControlDarkShadow(),
1016: "ScrollBar.thumbHighlight", getPrimaryControl(),
1017: "ScrollBar.thumbShadow", getPrimaryControlDarkShadow(),
1018: "ScrollBar.track", getControl(),
1019: "ScrollBar.trackHighlight", getControlDarkShadow(),
1020: "ScrollBar.width", new Integer(17),
1021:
1022: "ScrollPane.background", getControl(),
1023: "ScrollPane.border", new MetalBorders.ScrollPaneBorder(),
1024: "ScrollPane.foreground", getControlTextColor(),
1025:
1026: "Separator.background", getSeparatorBackground(),
1027: "Separator.foreground", getSeparatorForeground(),
1028: "Separator.highlight", getControlHighlight(),
1029: "Separator.shadow", getControlShadow(),
1030:
1031: "Slider.background", getControl(),
1032: "Slider.focus", getFocusColor(),
1033: "Slider.focusInsets", new InsetsUIResource(0, 0, 0, 0),
1034: "Slider.foreground", getPrimaryControlShadow(),
1035: "Slider.highlight", getControlHighlight(),
1036: "Slider.horizontalThumbIcon",
1037: MetalIconFactory.getHorizontalSliderThumbIcon(),
1038: "Slider.majorTickLength", new Integer(6),
1039: "Slider.shadow", getControlShadow(),
1040: "Slider.trackWidth", new Integer(7),
1041: "Slider.verticalThumbIcon",
1042: MetalIconFactory.getVerticalSliderThumbIcon(),
1043:
1044: "Spinner.background", getControl(),
1045: "Spinner.font", new FontUIResource("Dialog", Font.BOLD, 12),
1046: "Spinner.foreground", getControl(),
1047:
1048: "SplitPane.background", getControl(),
1049: "SplitPane.darkShadow", getControlDarkShadow(),
1050: "SplitPane.dividerFocusColor", getPrimaryControl(),
1051: "SplitPane.highlight", getControlHighlight(),
1052: "SplitPane.shadow", getControlShadow(),
1053:
1054: "SplitPaneDivider.draggingColor", Color.DARK_GRAY,
1055:
1056: "TabbedPane.background", getControlShadow(),
1057: "TabbedPane.darkShadow", getControlDarkShadow(),
1058: "TabbedPane.focus", getPrimaryControlDarkShadow(),
1059: "TabbedPane.font", new FontUIResource("Dialog", Font.BOLD, 12),
1060: "TabbedPane.foreground", getControlTextColor(),
1061: "TabbedPane.highlight", getControlHighlight(),
1062: "TabbedPane.light", getControl(),
1063: "TabbedPane.selected", getControl(),
1064: "TabbedPane.selectHighlight", getControlHighlight(),
1065: "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 2, 1),
1066: "TabbedPane.shadow", getControlShadow(),
1067: "TabbedPane.tabAreaBackground", getControl(),
1068: "TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 6),
1069: "TabbedPane.tabInsets", new InsetsUIResource(0, 9, 1, 9),
1070:
1071: "Table.background", getWindowBackground(),
1072: "Table.focusCellBackground", getWindowBackground(),
1073: "Table.focusCellForeground", getControlTextColor(),
1074: "Table.foreground", getControlTextColor(),
1075: "Table.focusCellHighlightBorder",
1076: new BorderUIResource.LineBorderUIResource(getControlShadow()),
1077: "Table.focusCellBackground", getWindowBackground(),
1078: "Table.gridColor", getControlDarkShadow(),
1079: "Table.selectionBackground", new ColorUIResource(204, 204, 255),
1080: "Table.selectionForeground", new ColorUIResource(0, 0, 0),
1081:
1082: "TableHeader.background", getControl(),
1083: "TableHeader.cellBorder", new MetalBorders.TableHeaderBorder(),
1084: "TableHeader.foreground", getControlTextColor(),
1085:
1086: "TextArea.background", getWindowBackground(),
1087: "TextArea.caretForeground", getUserTextColor(),
1088: "TextArea.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1089: "TextArea.foreground", getUserTextColor(),
1090: "TextArea.inactiveForeground", getInactiveSystemTextColor(),
1091: "TextArea.selectionBackground", getTextHighlightColor(),
1092: "TextArea.selectionForeground", getHighlightedTextColor(),
1093:
1094: "TextField.background", getWindowBackground(),
1095: "TextField.border",
1096: new BorderUIResource(MetalBorders.getTextFieldBorder()),
1097: "TextField.caretForeground", getUserTextColor(),
1098: "TextField.darkShadow", getControlDarkShadow(),
1099: "TextField.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1100: "TextField.foreground", getUserTextColor(),
1101: "TextField.highlight", getControlHighlight(),
1102: "TextField.inactiveBackground", getControl(),
1103: "TextField.inactiveForeground", getInactiveSystemTextColor(),
1104: "TextField.light", getControlHighlight(),
1105: "TextField.selectionBackground", getTextHighlightColor(),
1106: "TextField.selectionForeground", getHighlightedTextColor(),
1107: "TextField.shadow", getControlShadow(),
1108:
1109: "TextPane.background", getWindowBackground(),
1110: "TextPane.caretForeground", getUserTextColor(),
1111: "TextPane.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1112: "TextPane.foreground", getUserTextColor(),
1113: "TextPane.inactiveForeground", getInactiveSystemTextColor(),
1114: "TextPane.selectionBackground", getTextHighlightColor(),
1115: "TextPane.selectionForeground", getHighlightedTextColor(),
1116:
1117: "TitledBorder.font", new FontUIResource("Dialog", Font.BOLD, 12),
1118: "TitledBorder.titleColor", getSystemTextColor(),
1119:
1120: "ToggleButton.background", getControl(),
1121: "ToggleButton.border", MetalBorders.getToggleButtonBorder(),
1122: "ToggleButton.darkShadow", getControlDarkShadow(),
1123: "ToggleButton.disabledText", getInactiveControlTextColor(),
1124: "ToggleButton.focus", getFocusColor(),
1125: "ToggleButton.font", getControlTextFont(),
1126: "ToggleButton.foreground", getControlTextColor(),
1127: "ToggleButton.highlight", getControlHighlight(),
1128: "ToggleButton.light", getControlHighlight(),
1129: "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
1130: "ToggleButton.select", getControlShadow(),
1131: "ToggleButton.shadow", getControlShadow(),
1132:
1133: "ToolBar.background", getMenuBackground(),
1134: "ToolBar.darkShadow", getControlDarkShadow(),
1135: "ToolBar.dockingBackground", getMenuBackground(),
1136: "ToolBar.dockingForeground", getPrimaryControlDarkShadow(),
1137: "ToolBar.floatingBackground", getMenuBackground(),
1138: "ToolBar.floatingForeground", getPrimaryControl(),
1139: "ToolBar.font", new FontUIResource("Dialog", Font.BOLD, 12),
1140: "ToolBar.foreground", getMenuForeground(),
1141: "ToolBar.highlight", getControlHighlight(),
1142: "ToolBar.light", getControlHighlight(),
1143: "ToolBar.shadow", getControlShadow(),
1144: "ToolBar.border", new MetalBorders.ToolBarBorder(),
1145:
1146: "ToolTip.background", getPrimaryControl(),
1147: "ToolTip.backgroundInactive", getControl(),
1148: "ToolTip.border", new BorderUIResource.LineBorderUIResource(getPrimaryControlDarkShadow(), 1),
1149: "ToolTip.borderInactive", new BorderUIResource.LineBorderUIResource(getControlDarkShadow(), 1),
1150: "ToolTip.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1151: "ToolTip.foreground", getPrimaryControlInfo(),
1152: "ToolTip.foregroundInactive", getControlDarkShadow(),
1153:
1154: "Tree.background", getWindowBackground(),
1155: "Tree.closedIcon", MetalIconFactory.getTreeFolderIcon(),
1156: "Tree.collapsedIcon", MetalIconFactory.getTreeControlIcon(true),
1157: "Tree.expandedIcon", MetalIconFactory.getTreeControlIcon(false),
1158: "Tree.font", new FontUIResource("Dialog", Font.PLAIN, 12),
1159: "Tree.foreground", getUserTextColor(),
1160: "Tree.hash", getPrimaryControl(),
1161: "Tree.leafIcon", MetalIconFactory.getTreeLeafIcon(),
1162: "Tree.leftChildIndent", new Integer(7),
1163: "Tree.line", getPrimaryControl(),
1164: "Tree.openIcon", MetalIconFactory.getTreeFolderIcon(),
1165: "Tree.rightChildIndent", new Integer(13),
1166: "Tree.rowHeight", new Integer(0),
1167: "Tree.scrollsOnExpand", Boolean.TRUE,
1168: "Tree.selectionBackground", getTextHighlightColor(),
1169: "Tree.selectionBorder", new BorderUIResource.LineBorderUIResource(new Color(102, 102, 153)),
1170: "Tree.selectionBorderColor", getFocusColor(),
1171: "Tree.selectionForeground", getHighlightedTextColor(),
1172: "Tree.textBackground", getWindowBackground(),
1173: "Tree.textForeground", getUserTextColor(),
1174:
1175: "Viewport.background", getControl(),
1176: "Viewport.foreground", getUserTextColor()
1177: };
1178: defaults.putDefaults(myDefaults);
1179: }
1180:
1181:
1194: protected void initSystemColorDefaults(UIDefaults defaults)
1195: {
1196: super.initSystemColorDefaults(defaults);
1197: Object[] uiDefaults;
1198: uiDefaults = new Object[] {
1199: "control", new ColorUIResource(getControl()),
1200: "desktop", new ColorUIResource(getDesktopColor())
1201: };
1202: defaults.putDefaults(uiDefaults);
1203: }
1204:
1205:
1210: public static MetalTheme getCurrentTheme()
1211: {
1212: return theme;
1213: }
1214: }