KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwtx > swing > plaf > metal > MetalLookAndFeel


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: MetalLookAndFeel.java,v $
11    Revision 1.2 2004/04/15 11:24:33 bobintetley
12    (Dan Naab) ComponentUI, UIDefaults/UIManager and Accessibility support.
13    (Antonio Weber) TableColumnModelListener implementation and support
14
15    Revision 1.1 2004/01/26 08:11:14 bobintetley
16    Many bugfixes and addition of SwingSet
17
18
19 */

20
21 package swingwtx.swing.plaf.metal;
22
23 import java.util.HashMap JavaDoc;
24 import swingwt.awt.Component;
25 import swingwtx.swing.plaf.*;
26 import swingwtx.swing.UIDefaults;
27
28 public class MetalLookAndFeel {
29
30     private static MetalTheme metalTheme = new DefaultMetalTheme();
31
32     /**
33      * Returns true if running on Windows. (spit spit)
34      */

35     static boolean isWindows() {
36         return false;
37     }
38
39     static boolean useSystemFonts() {
40         return false;
41     }
42
43     public String JavaDoc getName() {
44         return "Metal (NOT!)";
45     }
46
47     public String JavaDoc getID() {
48         return "Metal (NOT!)";
49     }
50
51     public String JavaDoc getDescription() {
52         return "Your native platform Look and Feel!";
53     }
54
55     
56     public boolean isNativeLookAndFeel() {
57         return false;
58     }
59
60
61     public boolean isSupportedLookAndFeel() {
62         return true;
63     }
64
65     public boolean getSupportsWindowDecorations() {
66         return true;
67     }
68
69     protected void initClassDefaults(HashMap JavaDoc table) {
70     }
71     
72     protected void initSystemColorDefaults(HashMap JavaDoc table) {
73     }
74
75     protected void initComponentDefaults(HashMap JavaDoc table) {
76     }
77
78     protected void createDefaultTheme() {
79         getCurrentTheme();
80     }
81
82     public HashMap JavaDoc getDefaults() {
83         UIDefaults table = new UIDefaults();
84     initClassDefaults(table);
85     initSystemColorDefaults(table);
86     initComponentDefaults(table);
87     return table;
88     }
89     
90     public void provideErrorFeedback(Component component) {
91     }
92
93     public static void setCurrentTheme(MetalTheme theme) {
94     metalTheme = theme;
95     }
96
97     private static MetalTheme getCurrentTheme() {
98         return metalTheme;
99     }
100
101     public static FontUIResource getControlTextFont() { return getCurrentTheme().getControlTextFont();}
102     public static FontUIResource getSystemTextFont() { return getCurrentTheme().getSystemTextFont();}
103     public static FontUIResource getUserTextFont() { return getCurrentTheme().getUserTextFont();}
104     public static FontUIResource getMenuTextFont() { return getCurrentTheme().getMenuTextFont();}
105     public static FontUIResource getWindowTitleFont() { return getCurrentTheme().getWindowTitleFont();}
106     public static FontUIResource getSubTextFont() { return getCurrentTheme().getSubTextFont();}
107
108     public static ColorUIResource getDesktopColor() { return getCurrentTheme().getDesktopColor(); }
109     public static ColorUIResource getFocusColor() { return getCurrentTheme().getFocusColor(); }
110
111     public static ColorUIResource getWhite() { return getCurrentTheme().getWhite(); }
112     public static ColorUIResource getBlack() { return getCurrentTheme().getBlack(); }
113     public static ColorUIResource getControl() { return getCurrentTheme().getControl(); }
114     public static ColorUIResource getControlShadow() { return getCurrentTheme().getControlShadow(); }
115     public static ColorUIResource getControlDarkShadow() { return getCurrentTheme().getControlDarkShadow(); }
116     public static ColorUIResource getControlInfo() { return getCurrentTheme().getControlInfo(); }
117     public static ColorUIResource getControlHighlight() { return getCurrentTheme().getControlHighlight(); }
118     public static ColorUIResource getControlDisabled() { return getCurrentTheme().getControlDisabled(); }
119
120     public static ColorUIResource getPrimaryControl() { return getCurrentTheme().getPrimaryControl(); }
121     public static ColorUIResource getPrimaryControlShadow() { return getCurrentTheme().getPrimaryControlShadow(); }
122     public static ColorUIResource getPrimaryControlDarkShadow() { return getCurrentTheme().getPrimaryControlDarkShadow(); }
123     public static ColorUIResource getPrimaryControlInfo() { return getCurrentTheme().getPrimaryControlInfo(); }
124     public static ColorUIResource getPrimaryControlHighlight() { return getCurrentTheme().getPrimaryControlHighlight(); }
125
126     public static ColorUIResource getSystemTextColor() { return getCurrentTheme().getSystemTextColor(); }
127     public static ColorUIResource getControlTextColor() { return getCurrentTheme().getControlTextColor(); }
128     public static ColorUIResource getInactiveControlTextColor() { return getCurrentTheme().getInactiveControlTextColor(); }
129     public static ColorUIResource getInactiveSystemTextColor() { return getCurrentTheme().getInactiveSystemTextColor(); }
130     public static ColorUIResource getUserTextColor() { return getCurrentTheme().getUserTextColor(); }
131     public static ColorUIResource getTextHighlightColor() { return getCurrentTheme().getTextHighlightColor(); }
132     public static ColorUIResource getHighlightedTextColor() { return getCurrentTheme().getHighlightedTextColor(); }
133
134     public static ColorUIResource getWindowBackground() { return getCurrentTheme().getWindowBackground(); }
135     public static ColorUIResource getWindowTitleBackground() { return getCurrentTheme().getWindowTitleBackground(); }
136     public static ColorUIResource getWindowTitleForeground() { return getCurrentTheme().getWindowTitleForeground(); }
137     public static ColorUIResource getWindowTitleInactiveBackground() { return getCurrentTheme().getWindowTitleInactiveBackground(); }
138     public static ColorUIResource getWindowTitleInactiveForeground() { return getCurrentTheme().getWindowTitleInactiveForeground(); }
139
140     public static ColorUIResource getMenuBackground() { return getCurrentTheme().getMenuBackground(); }
141     public static ColorUIResource getMenuForeground() { return getCurrentTheme().getMenuForeground(); }
142     public static ColorUIResource getMenuSelectedBackground() { return getCurrentTheme().getMenuSelectedBackground(); }
143     public static ColorUIResource getMenuSelectedForeground() { return getCurrentTheme().getMenuSelectedForeground(); }
144     public static ColorUIResource getMenuDisabledForeground() { return getCurrentTheme().getMenuDisabledForeground(); }
145     public static ColorUIResource getSeparatorBackground() { return getCurrentTheme().getSeparatorBackground(); }
146     public static ColorUIResource getSeparatorForeground() { return getCurrentTheme().getSeparatorForeground(); }
147     public static ColorUIResource getAcceleratorForeground() { return getCurrentTheme().getAcceleratorForeground(); }
148     public static ColorUIResource getAcceleratorSelectedForeground() { return getCurrentTheme().getAcceleratorSelectedForeground(); }
149
150 }
151
Popular Tags