KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MetalLookAndFeel.java 1.182 04/04/02
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing.plaf.metal;
9
10 import java.awt.*;
11 import javax.swing.plaf.*;
12 import javax.swing.*;
13 import javax.swing.plaf.basic.*;
14 import javax.swing.border.*;
15 import javax.swing.text.JTextComponent JavaDoc;
16 import javax.swing.text.DefaultEditorKit JavaDoc;
17 import java.util.*;
18
19 import java.awt.Font JavaDoc;
20 import java.awt.Color JavaDoc;
21 import java.awt.SystemColor JavaDoc;
22 import java.awt.event.KeyEvent JavaDoc;
23 import java.awt.event.InputEvent JavaDoc;
24 import java.lang.reflect.*;
25 import java.net.URL JavaDoc;
26 import java.io.Serializable JavaDoc;
27
28 import java.security.AccessController JavaDoc;
29 import java.security.PrivilegedAction JavaDoc;
30 import sun.awt.AppContext;
31 import sun.security.action.GetPropertyAction;
32 import sun.swing.SwingLazyValue;
33
34
35 /**
36  * Implements the Java look and feel (codename: Metal).
37  * <p>
38  * By default metal uses bold fonts for many controls. To make all
39  * controls (with the exception of the internal frame title bars and
40  * client decorated frame title bars) use plain fonts you can do either of
41  * the following:
42  * <ul>
43  * <li>Set the system property <code>swing.boldMetal</code> to
44  * <code>false</code>. For example,
45  * <code>java&nbsp;-Dswing.boldMetal=false&nbsp;MyApp</code>.
46  * <li>Set the defaults property <code>swing.boldMetal</code> to
47  * <code>Boolean.FALSE</code>. For example:
48  * <code>UIManager.put("swing.boldMetal",&nbsp;Boolean.FALSE);</code>
49  * </ul>
50  * The defaults property <code>swing.boldMetal</code>, if set,
51  * takes precendence over the system property of the same name. After
52  * setting this defaults property you need to re-install the
53  * <code>MetalLookAndFeel</code>, as well as update the UI
54  * of any previously created widgets. Otherwise the results are undefined.
55  * These lines of code show you how to accomplish this:
56  * <pre>
57  * // turn off bold fonts
58  * UIManager.put("swing.boldMetal", Boolean.FALSE);
59  *
60  * // re-install the Metal Look and Feel
61  * UIManager.setLookAndFeel(new MetalLookAndFeel());
62  *
63  * // only needed to update existing widgets
64  * SwingUtilities.updateComponentTreeUI(rootComponent);
65  * </pre>
66  * <p>
67  * <strong>Warning:</strong>
68  * Serialized objects of this class will not be compatible with
69  * future Swing releases. The current serialization support is
70  * appropriate for short term storage or RMI between applications running
71  * the same version of Swing. As of 1.4, support for long term storage
72  * of all JavaBeans<sup><font size="-2">TM</font></sup>
73  * has been added to the <code>java.beans</code> package.
74  * Please see {@link java.beans.XMLEncoder}.
75  *
76  * @version @(#)MetalLookAndFeel.java 1.182 04/04/02
77  * @author Steve Wilson
78  */

79 public class MetalLookAndFeel extends BasicLookAndFeel
80 {
81
82     private static boolean METAL_LOOK_AND_FEEL_INITED = false;
83
84     private static MetalTheme JavaDoc currentTheme;
85     private static boolean isOnlyOneContext = true;
86     private static AppContext cachedAppContext;
87
88     /**
89      * True if checked for windows yet.
90      */

91     private static boolean checkedWindows;
92     /**
93      * True if running on Windows.
94      */

95     private static boolean isWindows;
96
97     /**
98      * Set to true first time we've checked swing.useSystemFontSettings.
99      */

100     private static boolean checkedSystemFontSettings;
101
102     /**
103      * True indicates we should use system fonts, unless the developer has
104      * specified otherwise with Application.useSystemFontSettings.
105      */

106     private static boolean useSystemFonts;
107
108
109     /**
110      * Returns true if running on Windows.
111      */

112     static boolean isWindows() {
113         if (!checkedWindows) {
114             String JavaDoc osName = (String JavaDoc)AccessController.doPrivileged(
115                 new GetPropertyAction("os.name"));
116             if (osName != null && osName.indexOf("Windows") != -1) {
117                 isWindows = true;
118                 String JavaDoc systemFonts = (String JavaDoc)AccessController.doPrivileged(
119                     new GetPropertyAction("swing.useSystemFontSettings"));
120                 useSystemFonts = (systemFonts != null &&
121                                (Boolean.valueOf(systemFonts).booleanValue()));
122             }
123             checkedWindows = true;
124         }
125         return isWindows;
126     }
127
128     /**
129      * Returns true if system fonts should be used, this is only useful
130      * for windows.
131      */

132     static boolean useSystemFonts() {
133         if (isWindows() && useSystemFonts) {
134             if (METAL_LOOK_AND_FEEL_INITED) {
135                 Object JavaDoc value = UIManager.get(
136                                  "Application.useSystemFontSettings");
137
138                 return (value == null || Boolean.TRUE.equals(value));
139             }
140             // If an instanceof MetalLookAndFeel hasn't been inited yet, we
141
// don't want to trigger loading of a UI by asking the UIManager
142
// for a property, assume the user wants system fonts. This will
143
// be properly adjusted when install is invoked on the
144
// MetalTheme
145
return true;
146         }
147         return false;
148     }
149
150     /**
151      * Returns true if the high contrast theme should be used as the default
152      * theme.
153      */

154     private static boolean useHighContrastTheme() {
155         if (isWindows() && useSystemFonts()) {
156             Boolean JavaDoc highContrast = (Boolean JavaDoc)Toolkit.getDefaultToolkit().
157                                   getDesktopProperty("win.highContrast.on");
158
159             return (highContrast == null) ? false : highContrast.
160                                             booleanValue();
161         }
162         return false;
163     }
164
165     /**
166      * Returns true if we're using the Ocean Theme.
167      */

168     static boolean usingOcean() {
169         return (getCurrentTheme() instanceof OceanTheme JavaDoc);
170     }
171
172     public String JavaDoc getName() {
173         return "Metal";
174     }
175
176     public String JavaDoc getID() {
177         return "Metal";
178     }
179
180     public String JavaDoc getDescription() {
181         return "The Java(tm) Look and Feel";
182     }
183
184     
185     public boolean isNativeLookAndFeel() {
186         return false;
187     }
188
189
190     public boolean isSupportedLookAndFeel() {
191         return true;
192     }
193     
194     /**
195      * Returns true if the <code>LookAndFeel</code> returned
196      * <code>RootPaneUI</code> instances support providing Window decorations
197      * in a <code>JRootPane</code>.
198      * <p>
199      * This implementation returns true, since it does support providing
200      * these border and window title pane decorations.
201      *
202      * @return True if the RootPaneUI instances created support client side
203      * decorations
204      * @see JDialog#setDefaultLookAndFeelDecorated
205      * @see JFrame#setDefaultLookAndFeelDecorated
206      * @see JRootPane#setWindowDecorationStyle
207      * @since 1.4
208      */

209     public boolean getSupportsWindowDecorations() {
210         return true;
211     }
212
213     /**
214      * Creates the mapping from
215      * UI class IDs to <code>ComponentUI</code> classes,
216      * putting the ID-<code>ComponentUI</code> pairs
217      * in the passed-in defaults table.
218      * Each <code>JComponent</code> class
219      * specifies its own UI class ID string.
220      * For example,
221      * <code>JButton</code> has the UI class ID "ButtonUI",
222      * which this method maps to "javax.swing.plaf.metal.MetalButtonUI".
223      *
224      * @see BasicLookAndFeel#getDefaults
225      * @see javax.swing.JComponent#getUIClassID
226      */

227     protected void initClassDefaults(UIDefaults table)
228     {
229         super.initClassDefaults(table);
230         final String JavaDoc metalPackageName = "javax.swing.plaf.metal.";
231
232         Object JavaDoc[] uiDefaults = {
233                    "ButtonUI", metalPackageName + "MetalButtonUI",
234                  "CheckBoxUI", metalPackageName + "MetalCheckBoxUI",
235                  "ComboBoxUI", metalPackageName + "MetalComboBoxUI",
236               "DesktopIconUI", metalPackageName + "MetalDesktopIconUI",
237               "FileChooserUI", metalPackageName + "MetalFileChooserUI",
238             "InternalFrameUI", metalPackageName + "MetalInternalFrameUI",
239                     "LabelUI", metalPackageName + "MetalLabelUI",
240        "PopupMenuSeparatorUI", metalPackageName + "MetalPopupMenuSeparatorUI",
241               "ProgressBarUI", metalPackageName + "MetalProgressBarUI",
242               "RadioButtonUI", metalPackageName + "MetalRadioButtonUI",
243                 "ScrollBarUI", metalPackageName + "MetalScrollBarUI",
244                "ScrollPaneUI", metalPackageName + "MetalScrollPaneUI",
245                 "SeparatorUI", metalPackageName + "MetalSeparatorUI",
246                    "SliderUI", metalPackageName + "MetalSliderUI",
247                 "SplitPaneUI", metalPackageName + "MetalSplitPaneUI",
248                "TabbedPaneUI", metalPackageName + "MetalTabbedPaneUI",
249                 "TextFieldUI", metalPackageName + "MetalTextFieldUI",
250              "ToggleButtonUI", metalPackageName + "MetalToggleButtonUI",
251                   "ToolBarUI", metalPackageName + "MetalToolBarUI",
252                   "ToolTipUI", metalPackageName + "MetalToolTipUI",
253                      "TreeUI", metalPackageName + "MetalTreeUI",
254                  "RootPaneUI", metalPackageName + "MetalRootPaneUI",
255         };
256
257         table.putDefaults(uiDefaults);
258     }
259
260     /**
261      * Load the SystemColors into the defaults table. The keys
262      * for SystemColor defaults are the same as the names of
263      * the public fields in SystemColor.
264      */

265     protected void initSystemColorDefaults(UIDefaults table)
266     {
267         MetalTheme JavaDoc theme = getCurrentTheme();
268         Color JavaDoc control = theme.getControl();
269         Object JavaDoc[] systemColors = {
270                 "desktop", theme.getDesktopColor(), /* Color of the desktop background */
271           "activeCaption", theme.getWindowTitleBackground(), /* Color for captions (title bars) when they are active. */
272       "activeCaptionText", theme.getWindowTitleForeground(), /* Text color for text in captions (title bars). */
273     "activeCaptionBorder", theme.getPrimaryControlShadow(), /* Border color for caption (title bar) window borders. */
274         "inactiveCaption", theme.getWindowTitleInactiveBackground(), /* Color for captions (title bars) when not active. */
275     "inactiveCaptionText", theme.getWindowTitleInactiveForeground(), /* Text color for text in inactive captions (title bars). */
276   "inactiveCaptionBorder", theme.getControlShadow(), /* Border color for inactive caption (title bar) window borders. */
277                  "window", theme.getWindowBackground(), /* Default color for the interior of windows */
278            "windowBorder", control, /* ??? */
279              "windowText", theme.getUserTextColor(), /* ??? */
280                    "menu", theme.getMenuBackground(), /* Background color for menus */
281                "menuText", theme.getMenuForeground(), /* Text color for menus */
282                    "text", theme.getWindowBackground(), /* Text background color */
283                "textText", theme.getUserTextColor(), /* Text foreground color */
284           "textHighlight", theme.getTextHighlightColor(), /* Text background color when selected */
285       "textHighlightText", theme.getHighlightedTextColor(), /* Text color when selected */
286        "textInactiveText", theme.getInactiveSystemTextColor(), /* Text color when disabled */
287                 "control", control, /* Default color for controls (buttons, sliders, etc) */
288             "controlText", theme.getControlTextColor(), /* Default color for text in controls */
289        "controlHighlight", theme.getControlHighlight(), /* Specular highlight (opposite of the shadow) */
290      "controlLtHighlight", theme.getControlHighlight(), /* Highlight color for controls */
291           "controlShadow", theme.getControlShadow(), /* Shadow color for controls */
292         "controlDkShadow", theme.getControlDarkShadow(), /* Dark shadow color for controls */
293               "scrollbar", control, /* Scrollbar background (usually the "track") */
294                    "info", theme.getPrimaryControl(), /* ToolTip Background */
295                "infoText", theme.getPrimaryControlInfo() /* ToolTip Text */
296         };
297
298         table.putDefaults(systemColors);
299     }
300
301     /**
302      * Initialize the defaults table with the name of the ResourceBundle
303      * used for getting localized defaults.
304      */

305     private void initResourceBundle(UIDefaults table) {
306         table.addResourceBundle( "com.sun.swing.internal.plaf.metal.resources.metal" );
307     }
308
309     protected void initComponentDefaults(UIDefaults table) {
310         super.initComponentDefaults( table );
311
312         initResourceBundle(table);
313
314         Color JavaDoc acceleratorForeground = getAcceleratorForeground();
315         Color JavaDoc acceleratorSelectedForeground = getAcceleratorSelectedForeground();
316         Color JavaDoc control = getControl();
317         Color JavaDoc controlHighlight = getControlHighlight();
318         Color JavaDoc controlShadow = getControlShadow();
319         Color JavaDoc controlDarkShadow = getControlDarkShadow();
320         Color JavaDoc controlTextColor = getControlTextColor();
321         Color JavaDoc focusColor = getFocusColor();
322         Color JavaDoc inactiveControlTextColor = getInactiveControlTextColor();
323         Color JavaDoc menuBackground = getMenuBackground();
324         Color JavaDoc menuSelectedBackground = getMenuSelectedBackground();
325         Color JavaDoc menuDisabledForeground = getMenuDisabledForeground();
326         Color JavaDoc menuSelectedForeground = getMenuSelectedForeground();
327         Color JavaDoc primaryControl = getPrimaryControl();
328         Color JavaDoc primaryControlDarkShadow = getPrimaryControlDarkShadow();
329         Color JavaDoc primaryControlShadow = getPrimaryControlShadow();
330         Color JavaDoc systemTextColor = getSystemTextColor();
331
332         Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0);
333
334         Integer JavaDoc zero = new Integer JavaDoc(0);
335
336     Object JavaDoc textFieldBorder =
337         new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
338                       "getTextFieldBorder");
339
340         Object JavaDoc dialogBorder = new MetalLazyValue(
341                           "javax.swing.plaf.metal.MetalBorders$DialogBorder");
342
343         Object JavaDoc questionDialogBorder = new MetalLazyValue(
344                   "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
345
346     Object JavaDoc fieldInputMap = new UIDefaults.LazyInputMap(new Object JavaDoc[] {
347                "ctrl C", DefaultEditorKit.copyAction,
348                "ctrl V", DefaultEditorKit.pasteAction,
349                "ctrl X", DefaultEditorKit.cutAction,
350                  "COPY", DefaultEditorKit.copyAction,
351                 "PASTE", DefaultEditorKit.pasteAction,
352                   "CUT", DefaultEditorKit.cutAction,
353                "shift LEFT", DefaultEditorKit.selectionBackwardAction,
354                     "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
355               "shift RIGHT", DefaultEditorKit.selectionForwardAction,
356            "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
357             "ctrl LEFT", DefaultEditorKit.previousWordAction,
358              "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
359                "ctrl RIGHT", DefaultEditorKit.nextWordAction,
360             "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
361           "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
362            "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
363          "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
364           "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
365                "ctrl A", DefaultEditorKit.selectAllAction,
366                  "HOME", DefaultEditorKit.beginLineAction,
367                   "END", DefaultEditorKit.endLineAction,
368                "shift HOME", DefaultEditorKit.selectionBeginLineAction,
369                 "shift END", DefaultEditorKit.selectionEndLineAction,
370                        "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
371                            "ctrl H", DefaultEditorKit.deletePrevCharAction,
372                            "DELETE", DefaultEditorKit.deleteNextCharAction,
373                             "RIGHT", DefaultEditorKit.forwardAction,
374                              "LEFT", DefaultEditorKit.backwardAction,
375                          "KP_RIGHT", DefaultEditorKit.forwardAction,
376                           "KP_LEFT", DefaultEditorKit.backwardAction,
377                 "ENTER", JTextField.notifyAction,
378           "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
379                    "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
380     });
381
382         Object JavaDoc passwordInputMap = new UIDefaults.LazyInputMap(new Object JavaDoc[] {
383                            "ctrl C", DefaultEditorKit.copyAction,
384                            "ctrl V", DefaultEditorKit.pasteAction,
385                            "ctrl X", DefaultEditorKit.cutAction,
386                              "COPY", DefaultEditorKit.copyAction,
387                             "PASTE", DefaultEditorKit.pasteAction,
388                               "CUT", DefaultEditorKit.cutAction,
389                        "shift LEFT", DefaultEditorKit.selectionBackwardAction,
390                     "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
391                       "shift RIGHT", DefaultEditorKit.selectionForwardAction,
392                    "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
393                         "ctrl LEFT", DefaultEditorKit.beginLineAction,
394                      "ctrl KP_LEFT", DefaultEditorKit.beginLineAction,
395                        "ctrl RIGHT", DefaultEditorKit.endLineAction,
396                     "ctrl KP_RIGHT", DefaultEditorKit.endLineAction,
397                   "ctrl shift LEFT", DefaultEditorKit.selectionBeginLineAction,
398                "ctrl shift KP_LEFT", DefaultEditorKit.selectionBeginLineAction,
399                  "ctrl shift RIGHT", DefaultEditorKit.selectionEndLineAction,
400               "ctrl shift KP_RIGHT", DefaultEditorKit.selectionEndLineAction,
401                            "ctrl A", DefaultEditorKit.selectAllAction,
402                              "HOME", DefaultEditorKit.beginLineAction,
403                               "END", DefaultEditorKit.endLineAction,
404                        "shift HOME", DefaultEditorKit.selectionBeginLineAction,
405                         "shift END", DefaultEditorKit.selectionEndLineAction,
406                        "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
407                            "ctrl H", DefaultEditorKit.deletePrevCharAction,
408                            "DELETE", DefaultEditorKit.deleteNextCharAction,
409                             "RIGHT", DefaultEditorKit.forwardAction,
410                              "LEFT", DefaultEditorKit.backwardAction,
411                          "KP_RIGHT", DefaultEditorKit.forwardAction,
412                           "KP_LEFT", DefaultEditorKit.backwardAction,
413                             "ENTER", JTextField.notifyAction,
414                   "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
415                    "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
416         });
417
418     Object JavaDoc multilineInputMap = new UIDefaults.LazyInputMap(new Object JavaDoc[] {
419                "ctrl C", DefaultEditorKit.copyAction,
420                "ctrl V", DefaultEditorKit.pasteAction,
421                "ctrl X", DefaultEditorKit.cutAction,
422                  "COPY", DefaultEditorKit.copyAction,
423                 "PASTE", DefaultEditorKit.pasteAction,
424                   "CUT", DefaultEditorKit.cutAction,
425                "shift LEFT", DefaultEditorKit.selectionBackwardAction,
426                     "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
427               "shift RIGHT", DefaultEditorKit.selectionForwardAction,
428            "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
429             "ctrl LEFT", DefaultEditorKit.previousWordAction,
430              "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
431                "ctrl RIGHT", DefaultEditorKit.nextWordAction,
432             "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
433           "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
434            "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
435          "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
436           "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
437                "ctrl A", DefaultEditorKit.selectAllAction,
438                  "HOME", DefaultEditorKit.beginLineAction,
439                   "END", DefaultEditorKit.endLineAction,
440                "shift HOME", DefaultEditorKit.selectionBeginLineAction,
441                 "shift END", DefaultEditorKit.selectionEndLineAction,
442
443                    "UP", DefaultEditorKit.upAction,
444                 "KP_UP", DefaultEditorKit.upAction,
445                  "DOWN", DefaultEditorKit.downAction,
446               "KP_DOWN", DefaultEditorKit.downAction,
447               "PAGE_UP", DefaultEditorKit.pageUpAction,
448             "PAGE_DOWN", DefaultEditorKit.pageDownAction,
449             "shift PAGE_UP", "selection-page-up",
450               "shift PAGE_DOWN", "selection-page-down",
451            "ctrl shift PAGE_UP", "selection-page-left",
452          "ctrl shift PAGE_DOWN", "selection-page-right",
453              "shift UP", DefaultEditorKit.selectionUpAction,
454               "shift KP_UP", DefaultEditorKit.selectionUpAction,
455                "shift DOWN", DefaultEditorKit.selectionDownAction,
456             "shift KP_DOWN", DefaultEditorKit.selectionDownAction,
457                 "ENTER", DefaultEditorKit.insertBreakAction,
458                        "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
459                            "ctrl H", DefaultEditorKit.deletePrevCharAction,
460                            "DELETE", DefaultEditorKit.deleteNextCharAction,
461                             "RIGHT", DefaultEditorKit.forwardAction,
462                              "LEFT", DefaultEditorKit.backwardAction,
463                          "KP_RIGHT", DefaultEditorKit.forwardAction,
464                           "KP_LEFT", DefaultEditorKit.backwardAction,
465                   "TAB", DefaultEditorKit.insertTabAction,
466           "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
467             "ctrl HOME", DefaultEditorKit.beginAction,
468              "ctrl END", DefaultEditorKit.endAction,
469           "ctrl shift HOME", DefaultEditorKit.selectionBeginAction,
470            "ctrl shift END", DefaultEditorKit.selectionEndAction,
471                            "ctrl T", "next-link-action",
472                      "ctrl shift T", "previous-link-action",
473                        "ctrl SPACE", "activate-link-action",
474                    "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
475     });
476
477         Object JavaDoc scrollPaneBorder = new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$ScrollPaneBorder");
478         Object JavaDoc buttonBorder =
479                 new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
480                       "getButtonBorder");
481   
482         Object JavaDoc toggleButtonBorder =
483         new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
484                       "getToggleButtonBorder");
485
486         Object JavaDoc titledBorderBorder =
487         new SwingLazyValue(
488               "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
489               new Object JavaDoc[] {controlShadow});
490
491         Object JavaDoc desktopIconBorder =
492         new SwingLazyValue(
493               "javax.swing.plaf.metal.MetalBorders",
494               "getDesktopIconBorder");
495
496         Object JavaDoc menuBarBorder =
497         new SwingLazyValue(
498               "javax.swing.plaf.metal.MetalBorders$MenuBarBorder");
499
500         Object JavaDoc popupMenuBorder =
501         new SwingLazyValue(
502              "javax.swing.plaf.metal.MetalBorders$PopupMenuBorder");
503         Object JavaDoc menuItemBorder =
504         new SwingLazyValue(
505              "javax.swing.plaf.metal.MetalBorders$MenuItemBorder");
506
507     Object JavaDoc menuItemAcceleratorDelimiter = new String JavaDoc("-");
508         Object JavaDoc toolBarBorder = new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$ToolBarBorder");
509
510     Object JavaDoc progressBarBorder = new SwingLazyValue(
511               "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
512               new Object JavaDoc[] {controlDarkShadow, new Integer JavaDoc(1)});
513
514         Object JavaDoc toolTipBorder = new SwingLazyValue(
515               "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
516               new Object JavaDoc[] {primaryControlDarkShadow});
517
518         Object JavaDoc toolTipBorderInactive = new SwingLazyValue(
519               "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
520               new Object JavaDoc[] {controlDarkShadow});
521
522         Object JavaDoc focusCellHighlightBorder = new SwingLazyValue(
523               "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
524               new Object JavaDoc[] {focusColor});
525
526         Object JavaDoc tabbedPaneTabAreaInsets = new InsetsUIResource(4, 2, 0, 6);
527
528         Object JavaDoc tabbedPaneTabInsets = new InsetsUIResource(0, 9, 1, 9);
529
530     final Object JavaDoc[] internalFrameIconArgs = new Object JavaDoc[1];
531     internalFrameIconArgs[0] = new Integer JavaDoc(16);
532
533     Object JavaDoc[] defaultCueList = new Object JavaDoc[] {
534         "OptionPane.errorSound",
535         "OptionPane.informationSound",
536         "OptionPane.questionSound",
537         "OptionPane.warningSound" };
538
539         MetalTheme JavaDoc theme = getCurrentTheme();
540         Object JavaDoc menuTextValue = new FontActiveValue(theme,
541                                                    MetalTheme.MENU_TEXT_FONT);
542         Object JavaDoc controlTextValue = new FontActiveValue(theme,
543                                MetalTheme.CONTROL_TEXT_FONT);
544         Object JavaDoc userTextValue = new FontActiveValue(theme,
545                                                    MetalTheme.USER_TEXT_FONT);
546         Object JavaDoc windowTitleValue = new FontActiveValue(theme,
547                                MetalTheme.WINDOW_TITLE_FONT);
548         Object JavaDoc subTextValue = new FontActiveValue(theme,
549                                                   MetalTheme.SUB_TEXT_FONT);
550         Object JavaDoc systemTextValue = new FontActiveValue(theme,
551                                                  MetalTheme.SYSTEM_TEXT_FONT);
552         //
553
// DEFAULTS TABLE
554
//
555

556         Object JavaDoc[] defaults = {
557         // *** Auditory Feedback
558
"AuditoryCues.defaultCueList", defaultCueList,
559         // this key defines which of the various cues to render
560
// This is disabled until sound bugs can be resolved.
561
"AuditoryCues.playList", null, // defaultCueList,
562

563             // Text (Note: many are inherited)
564
"TextField.border", textFieldBorder,
565         "TextField.font", userTextValue,
566
567             "PasswordField.border", textFieldBorder,
568             // passwordField.font should actually map to
569
// win.ansiFixed.font.height on windows.
570
"PasswordField.font", userTextValue,
571
572             // TextArea.font should actually map to win.ansiFixed.font.height
573
// on windows.
574
"TextArea.font", userTextValue,
575
576         "TextPane.background", table.get("window"),
577             "TextPane.font", userTextValue,
578
579         "EditorPane.background", table.get("window"),
580         "EditorPane.font", userTextValue,
581
582         "TextField.focusInputMap", fieldInputMap,
583         "PasswordField.focusInputMap", passwordInputMap,
584         "TextArea.focusInputMap", multilineInputMap,
585         "TextPane.focusInputMap", multilineInputMap,
586         "EditorPane.focusInputMap", multilineInputMap,
587
588             // FormattedTextFields
589
"FormattedTextField.border", textFieldBorder,
590             "FormattedTextField.font", userTextValue,
591             "FormattedTextField.focusInputMap",
592               new UIDefaults.LazyInputMap(new Object JavaDoc[] {
593                "ctrl C", DefaultEditorKit.copyAction,
594                "ctrl V", DefaultEditorKit.pasteAction,
595                "ctrl X", DefaultEditorKit.cutAction,
596                  "COPY", DefaultEditorKit.copyAction,
597                 "PASTE", DefaultEditorKit.pasteAction,
598                   "CUT", DefaultEditorKit.cutAction,
599                "shift LEFT", DefaultEditorKit.selectionBackwardAction,
600                     "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
601               "shift RIGHT", DefaultEditorKit.selectionForwardAction,
602            "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
603             "ctrl LEFT", DefaultEditorKit.previousWordAction,
604              "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
605                "ctrl RIGHT", DefaultEditorKit.nextWordAction,
606             "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
607           "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
608            "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
609          "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
610           "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
611                "ctrl A", DefaultEditorKit.selectAllAction,
612                  "HOME", DefaultEditorKit.beginLineAction,
613                   "END", DefaultEditorKit.endLineAction,
614                "shift HOME", DefaultEditorKit.selectionBeginLineAction,
615                 "shift END", DefaultEditorKit.selectionEndLineAction,
616                        "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
617                            "ctrl H", DefaultEditorKit.deletePrevCharAction,
618                            "DELETE", DefaultEditorKit.deleteNextCharAction,
619                             "RIGHT", DefaultEditorKit.forwardAction,
620                              "LEFT", DefaultEditorKit.backwardAction,
621                          "KP_RIGHT", DefaultEditorKit.forwardAction,
622                           "KP_LEFT", DefaultEditorKit.backwardAction,
623                 "ENTER", JTextField.notifyAction,
624           "ctrl BACK_SLASH", "unselect",
625                    "control shift O", "toggle-componentOrientation",
626                            "ESCAPE", "reset-field-edit",
627                                "UP", "increment",
628                             "KP_UP", "increment",
629                              "DOWN", "decrement",
630                           "KP_DOWN", "decrement",
631               }),
632             
633
634             // Buttons
635
"Button.defaultButtonFollowsFocus", Boolean.FALSE,
636             "Button.disabledText", inactiveControlTextColor,
637             "Button.select", controlShadow,
638             "Button.border", buttonBorder,
639             "Button.font", controlTextValue,
640             "Button.focus", focusColor,
641             "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object JavaDoc[] {
642                           "SPACE", "pressed",
643                  "released SPACE", "released"
644               }),
645
646             "CheckBox.disabledText", inactiveControlTextColor,
647             "Checkbox.select", controlShadow,
648             "CheckBox.font", controlTextValue,
649             "CheckBox.focus", focusColor,
650             "CheckBox.icon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getCheckBoxIcon"),
651         "CheckBox.focusInputMap",
652            new UIDefaults.LazyInputMap(new Object JavaDoc[] {
653                     "SPACE", "pressed",
654                    "released SPACE", "released"
655          }),
656
657             "RadioButton.disabledText", inactiveControlTextColor,
658             "RadioButton.select", controlShadow,
659             "RadioButton.icon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getRadioButtonIcon"),
660             "RadioButton.font", controlTextValue,
661             "RadioButton.focus", focusColor,
662         "RadioButton.focusInputMap",
663            new UIDefaults.LazyInputMap(new Object JavaDoc[] {
664                           "SPACE", "pressed",
665                  "released SPACE", "released"
666           }),
667
668             "ToggleButton.select", controlShadow,
669