KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > java > swing > plaf > windows > WindowsLookAndFeel


1 /*
2  * @(#)WindowsLookAndFeel.java 1.189 07/01/18
3  *
4  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 /*
9  * <p>These classes are designed to be used while the
10  * corresponding <code>LookAndFeel</code> class has been installed
11  * (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>).
12  * Using them while a different <code>LookAndFeel</code> is installed
13  * may produce unexpected results, including exceptions.
14  * Additionally, changing the <code>LookAndFeel</code>
15  * maintained by the <code>UIManager</code> without updating the
16  * corresponding <code>ComponentUI</code> of any
17  * <code>JComponent</code>s may also produce unexpected results,
18  * such as the wrong colors showing up, and is generally not
19  * encouraged.
20  *
21  */

22
23 package com.sun.java.swing.plaf.windows;
24
25 import java.awt.*;
26 import javax.swing.plaf.*;
27 import javax.swing.*;
28 import javax.swing.plaf.basic.*;
29 import javax.swing.border.*;
30 import javax.swing.text.JTextComponent JavaDoc;
31 import javax.swing.text.DefaultEditorKit JavaDoc;
32
33 import java.awt.Font JavaDoc;
34 import java.awt.Color JavaDoc;
35 import java.awt.SystemColor JavaDoc;
36 import java.awt.event.KeyEvent JavaDoc;
37 import java.awt.event.InputEvent JavaDoc;
38 import java.awt.event.ActionEvent JavaDoc;
39
40 import java.beans.PropertyChangeListener JavaDoc;
41 import java.beans.PropertyChangeEvent JavaDoc;
42
43 import java.net.URL JavaDoc;
44 import java.io.Serializable JavaDoc;
45 import java.security.AccessController JavaDoc;
46 import java.util.*;
47
48 import sun.awt.shell.ShellFolder;
49 import sun.font.FontManager;
50 import sun.security.action.GetPropertyAction;
51
52 import sun.swing.SwingLazyValue;
53 import sun.swing.BorderProvider;
54 import com.sun.java.swing.SwingUtilities2;
55
56 import com.sun.java.swing.plaf.windows.TMSchema.*;
57 import com.sun.java.swing.plaf.windows.XPStyle.Skin;
58
59 import com.sun.java.swing.plaf.windows.WindowsIconFactory
60
    .VistaMenuItemCheckIconFactory;
61
62 /**
63  * Implements the Windows95/98/NT/2000 Look and Feel.
64  * UI classes not implemented specifically for Windows will
65  * default to those implemented in Basic.
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 appropriate
70  * for short term storage or RMI between applications running the same
71  * version of Swing. A future release of Swing will provide support for
72  * long term persistence.
73  *
74  * @version 1.189 01/18/07
75  * @author unattributed
76  */

77 public class WindowsLookAndFeel extends BasicLookAndFeel
78 {
79     private Toolkit toolkit;
80     private boolean updatePending = false;
81
82     private boolean useSystemFontSettings = true;
83     private boolean useSystemFontSizeSettings;
84
85     // These properties are not used directly, but are kept as
86
// private members to avoid being GC'd.
87
private DesktopProperty themeActive, dllName, colorName, sizeName;
88
89     public String JavaDoc getName() {
90         return "Windows";
91     }
92
93     public String JavaDoc getDescription() {
94         return "The Microsoft Windows Look and Feel";
95     }
96
97     public String JavaDoc getID() {
98         return "Windows";
99     }
100     
101     public boolean isNativeLookAndFeel() {
102         String JavaDoc osName = System.getProperty("os.name");
103         return (osName != null) && (osName.indexOf("Windows") != -1);
104     }
105
106     public boolean isSupportedLookAndFeel() {
107         return isNativeLookAndFeel();
108     }
109
110     public void initialize() {
111         super.initialize();
112     toolkit = Toolkit.getDefaultToolkit();
113
114     // Set the flag which determines which version of Windows should
115
// be rendered. This flag only need to be set once.
116
// if version <= 4.0 then the classic LAF should be loaded.
117
String JavaDoc osVersion = System.getProperty("os.version");
118     if (osVersion != null) {
119         Float JavaDoc version = Float.valueOf(osVersion);
120         if (version.floatValue() <= 4.0) {
121         isClassicWindows = true;
122         } else {
123         isClassicWindows = false;
124         XPStyle.invalidateStyle();
125         }
126     }
127
128     // Using the fonts set by the user can potentially cause
129
// performance and compatibility issues, so allow this feature
130
// to be switched off either at runtime or programmatically
131
//
132
String JavaDoc systemFonts = (String JavaDoc) java.security.AccessController.doPrivileged(
133                new GetPropertyAction("swing.useSystemFontSettings"));
134     useSystemFontSettings = (systemFonts == null ||
135                                  Boolean.valueOf(systemFonts).booleanValue());
136
137         if (useSystemFontSettings) {
138             Object JavaDoc value = UIManager.get("Application.useSystemFontSettings");
139
140             useSystemFontSettings = (value == null ||
141                                      Boolean.TRUE.equals(value));
142         }
143         KeyboardFocusManager.getCurrentKeyboardFocusManager().
144             addKeyEventPostProcessor(WindowsRootPaneUI.altProcessor);
145
146     }
147     
148     /**
149      * Initialize the uiClassID to BasicComponentUI mapping.
150      * The JComponent classes define their own uiClassID constants
151      * (see AbstractComponent.getUIClassID). This table must
152      * map those constants to a BasicComponentUI class of the
153      * appropriate type.
154      *
155      * @see BasicLookAndFeel#getDefaults
156      */

157     protected void initClassDefaults(UIDefaults table)
158     {
159         super.initClassDefaults(table);
160
161         final String JavaDoc windowsPackageName = "com.sun.java.swing.plaf.windows.";
162
163         Object JavaDoc[] uiDefaults = {
164               "ButtonUI", windowsPackageName + "WindowsButtonUI",
165             "CheckBoxUI", windowsPackageName + "WindowsCheckBoxUI",
166     "CheckBoxMenuItemUI", windowsPackageName + "WindowsCheckBoxMenuItemUI",
167            "LabelUI", windowsPackageName + "WindowsLabelUI",
168          "RadioButtonUI", windowsPackageName + "WindowsRadioButtonUI",
169  "RadioButtonMenuItemUI", windowsPackageName + "WindowsRadioButtonMenuItemUI",
170         "ToggleButtonUI", windowsPackageName + "WindowsToggleButtonUI",
171          "ProgressBarUI", windowsPackageName + "WindowsProgressBarUI",
172           "SliderUI", windowsPackageName + "WindowsSliderUI",
173        "SeparatorUI", windowsPackageName + "WindowsSeparatorUI",
174            "SplitPaneUI", windowsPackageName + "WindowsSplitPaneUI",
175          "SpinnerUI", windowsPackageName + "WindowsSpinnerUI",
176       "TabbedPaneUI", windowsPackageName + "WindowsTabbedPaneUI",
177             "TextAreaUI", windowsPackageName + "WindowsTextAreaUI",
178            "TextFieldUI", windowsPackageName + "WindowsTextFieldUI",
179        "PasswordFieldUI", windowsPackageName + "WindowsPasswordFieldUI",
180             "TextPaneUI", windowsPackageName + "WindowsTextPaneUI",
181           "EditorPaneUI", windowsPackageName + "WindowsEditorPaneUI",
182                 "TreeUI", windowsPackageName + "WindowsTreeUI",
183          "ToolBarUI", windowsPackageName + "WindowsToolBarUI",
184     "ToolBarSeparatorUI", windowsPackageName + "WindowsToolBarSeparatorUI",
185             "ComboBoxUI", windowsPackageName + "WindowsComboBoxUI",
186      "TableHeaderUI", windowsPackageName + "WindowsTableHeaderUI",
187        "InternalFrameUI", windowsPackageName + "WindowsInternalFrameUI",
188          "DesktopPaneUI", windowsPackageName + "WindowsDesktopPaneUI",
189          "DesktopIconUI", windowsPackageName + "WindowsDesktopIconUI",
190          "FileChooserUI", windowsPackageName + "WindowsFileChooserUI",
191             "MenuUI", windowsPackageName + "WindowsMenuUI",
192         "MenuItemUI", windowsPackageName + "WindowsMenuItemUI",
193          "MenuBarUI", windowsPackageName + "WindowsMenuBarUI",
194        "PopupMenuUI", windowsPackageName + "WindowsPopupMenuUI",
195   "PopupMenuSeparatorUI", windowsPackageName + "WindowsPopupMenuSeparatorUI",
196        "ScrollBarUI", windowsPackageName + "WindowsScrollBarUI",
197         "RootPaneUI", windowsPackageName + "WindowsRootPaneUI"
198         };
199
200         table.putDefaults(uiDefaults);
201     }
202
203     /**
204      * Load the SystemColors into the defaults table. The keys
205      * for SystemColor defaults are the same as the names of
206      * the public fields in SystemColor. If the table is being
207      * created on a native Windows platform we use the SystemColor
208      * values, otherwise we create color objects whose values match
209      * the defaults Windows95 colors.
210      */

211     protected void initSystemColorDefaults(UIDefaults table)
212     {
213         String JavaDoc[] defaultSystemColors = {
214                 "desktop", "#005C5C", /* Color of the desktop background */
215           "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
216       "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
217     "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
218         "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
219     "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
220   "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
221                  "window", "#FFFFFF", /* Default color for the interior of windows */
222            "windowBorder", "#000000", /* ??? */
223              "windowText", "#000000", /* ??? */
224                    "menu", "#C0C0C0", /* Background color for menus */
225        "menuPressedItemB", "#000080", /* LightShadow of menubutton highlight */
226        "menuPressedItemF", "#FFFFFF", /* Default color for foreground "text" in menu item */
227                "menuText", "#000000", /* Text color for menus */
228                    "text", "#C0C0C0", /* Text background color */
229                "textText", "#000000", /* Text foreground color */
230           "textHighlight", "#000080", /* Text background color when selected */
231       "textHighlightText", "#FFFFFF", /* Text color when selected */
232        "textInactiveText", "#808080", /* Text color when disabled */
233                 "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
234             "controlText", "#000000", /* Default color for text in controls */
235        "controlHighlight", "#C0C0C0",
236
237   /*"controlHighlight", "#E0E0E0",*/ /* Specular highlight (opposite of the shadow) */
238      "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
239           "controlShadow", "#808080", /* Shadow color for controls */
240         "controlDkShadow", "#000000", /* Dark shadow color for controls */
241               "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
242                    "info", "#FFFFE1", /* ??? */
243                "infoText", "#000000" /* ??? */
244         };
245
246         loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());
247     }
248
249    /**
250      * Initialize the defaults table with the name of the ResourceBundle
251      * used for getting localized defaults.
252      */

253     private void initResourceBundle(UIDefaults table) {
254         table.addResourceBundle( "com.sun.java.swing.plaf.windows.resources.windows" );
255     }
256
257     // XXX - there are probably a lot of redundant values that could be removed.
258
// ie. Take a look at RadioButtonBorder, etc...
259
protected void initComponentDefaults(UIDefaults table)
260     {
261         super.initComponentDefaults( table );
262
263         initResourceBundle(table);
264
265         // *** Shared Fonts
266
Integer JavaDoc twelve = new Integer JavaDoc(12);
267     Integer JavaDoc eight = new Integer JavaDoc(8);
268     Integer JavaDoc ten = new Integer JavaDoc(10);
269     Integer JavaDoc fontPlain = new Integer JavaDoc(Font.PLAIN);
270     Integer JavaDoc fontBold = new Integer JavaDoc(Font.BOLD);
271
272     Object JavaDoc dialogPlain12 = new SwingLazyValue(
273                    "javax.swing.plaf.FontUIResource",
274                    null,
275                    new Object JavaDoc[] {"Dialog", fontPlain, twelve});
276
277     Object JavaDoc sansSerifPlain12 = new SwingLazyValue(
278               "javax.swing.plaf.FontUIResource",
279               null,
280               new Object JavaDoc[] {"SansSerif", fontPlain, twelve});
281     Object JavaDoc monospacedPlain12 = new SwingLazyValue(
282               "javax.swing.plaf.FontUIResource",
283               null,
284               new Object JavaDoc[] {"MonoSpaced", fontPlain, twelve});
285     Object JavaDoc dialogBold12 = new SwingLazyValue(
286               "javax.swing.plaf.FontUIResource",
287               null,
288               new Object JavaDoc[] {"Dialog", fontBold, twelve});
289
290         // *** Colors
291
// XXX - some of these doens't seem to be used
292
ColorUIResource red = new ColorUIResource(Color.red);
293         ColorUIResource black = new ColorUIResource(Color.black);
294         ColorUIResource white = new ColorUIResource(Color.white);
295         ColorUIResource yellow = new ColorUIResource(Color.yellow);
296         ColorUIResource gray = new ColorUIResource(Color.gray);
297         ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
298         ColorUIResource darkGray = new ColorUIResource(Color.darkGray);
299         ColorUIResource scrollBarTrack = lightGray;
300         ColorUIResource scrollBarTrackHighlight = darkGray;
301
302     // Set the flag which determines which version of Windows should
303
// be rendered. This flag only need to be set once.
304
// if version <= 4.0 then the classic LAF should be loaded.
305
String JavaDoc osVersion = System.getProperty("os.version");
306     if (osVersion != null) {
307         try {
308         Float JavaDoc version = Float.valueOf(osVersion);
309         if (version.floatValue() <= 4.0) {
310             isClassicWindows = true;
311         } else {
312             isClassicWindows = false;
313         }
314         } catch (NumberFormatException JavaDoc ex) {
315         isClassicWindows = false;
316         }
317     }
318
319         // *** Tree
320
ColorUIResource treeSelection = new ColorUIResource(0, 0, 128);
321         Object JavaDoc treeExpandedIcon = WindowsTreeUI.ExpandedIcon.createExpandedIcon();
322
323         Object JavaDoc treeCollapsedIcon = WindowsTreeUI.CollapsedIcon.createCollapsedIcon();
324
325
326     // *** Text
327
Object JavaDoc fieldInputMap = new UIDefaults.LazyInputMap(new Object JavaDoc[] {
328                   "control C", DefaultEditorKit.copyAction,
329                   "control V", DefaultEditorKit.pasteAction,
330                       "control X", DefaultEditorKit.cutAction,
331                "COPY", DefaultEditorKit.copyAction,
332               "PASTE", DefaultEditorKit.pasteAction,
333                 "CUT", DefaultEditorKit.cutAction,
334                  "control INSERT", DefaultEditorKit.copyAction,
335                    "shift INSERT", DefaultEditorKit.pasteAction,
336                    "shift DELETE", DefaultEditorKit.cutAction,
337                   "control A", DefaultEditorKit.selectAllAction,
338          "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
339                  "shift LEFT", DefaultEditorKit.selectionBackwardAction,
340                 "shift RIGHT", DefaultEditorKit.selectionForwardAction,
341                "control LEFT", DefaultEditorKit.previousWordAction,
342               "control RIGHT", DefaultEditorKit.nextWordAction,
343          "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
344             "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
345                        "HOME", DefaultEditorKit.beginLineAction,
346                         "END", DefaultEditorKit.endLineAction,
347                  "shift HOME", DefaultEditorKit.selectionBeginLineAction,
348                   "shift END", DefaultEditorKit.selectionEndLineAction,
349                      "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
350                          "ctrl H", DefaultEditorKit.deletePrevCharAction,
351                          "DELETE", DefaultEditorKit.deleteNextCharAction,
352                           "RIGHT", DefaultEditorKit.forwardAction,
353                            "LEFT", DefaultEditorKit.backwardAction,
354                        "KP_RIGHT", DefaultEditorKit.forwardAction,
355                         "KP_LEFT", DefaultEditorKit.backwardAction,
356                       "ENTER", JTextField.notifyAction,
357                 "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
358     });
359
360         Object JavaDoc passwordInputMap = new UIDefaults.LazyInputMap(new Object JavaDoc[] {
361                       "control C", DefaultEditorKit.copyAction,
362                       "control V", DefaultEditorKit.pasteAction,
363                       "control X", DefaultEditorKit.cutAction,
364                            "COPY", DefaultEditorKit.copyAction,
365                           "PASTE", DefaultEditorKit.pasteAction,
366                             "CUT", DefaultEditorKit.cutAction,
367                  "control INSERT", DefaultEditorKit.copyAction,
368                    "shift INSERT", DefaultEditorKit.pasteAction,
369                    "shift DELETE", DefaultEditorKit.cutAction,
370                       "control A", DefaultEditorKit.selectAllAction,
371              "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
372                      "shift LEFT", DefaultEditorKit.selectionBackwardAction,
373                     "shift RIGHT", DefaultEditorKit.selectionForwardAction,
374                    "control LEFT", DefaultEditorKit.beginLineAction,
375                   "control RIGHT", DefaultEditorKit.endLineAction,
376              "control shift LEFT", DefaultEditorKit.selectionBeginLineAction,
377             "control shift RIGHT", DefaultEditorKit.selectionEndLineAction,
378                            "HOME", DefaultEditorKit.beginLineAction,
379                             "END", DefaultEditorKit.endLineAction,
380                      "shift HOME", DefaultEditorKit.selectionBeginLineAction,
381                       "shift END", DefaultEditorKit.selectionEndLineAction,
382                      "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
383                          "ctrl H", DefaultEditorKit.deletePrevCharAction,
384                          "DELETE", DefaultEditorKit.deleteNextCharAction,
385                           "RIGHT", DefaultEditorKit.forwardAction,
386                            "LEFT", DefaultEditorKit.backwardAction,
387                        "KP_RIGHT", DefaultEditorKit.forwardAction,
388                         "KP_LEFT", DefaultEditorKit.backwardAction,
389                           "ENTER", JTextField.notifyAction,
390                 "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
391         });
392
393     Object JavaDoc multilineInputMap = new UIDefaults.LazyInputMap(new Object JavaDoc[] {
394               "control C", DefaultEditorKit.copyAction,
395               "control V", DefaultEditorKit.pasteAction,
396               "control X", DefaultEditorKit.cutAction,
397                "COPY", DefaultEditorKit.copyAction,
398               "PASTE", DefaultEditorKit.pasteAction,
399                 "CUT", DefaultEditorKit.cutAction,
400                  "control INSERT", DefaultEditorKit.copyAction,
401                    "shift INSERT", DefaultEditorKit.pasteAction,
402                    "shift DELETE", DefaultEditorKit.cutAction,
403              "shift LEFT", DefaultEditorKit.selectionBackwardAction,
404             "shift RIGHT", DefaultEditorKit.selectionForwardAction,
405            "control LEFT", DefaultEditorKit.previousWordAction,
406           "control RIGHT", DefaultEditorKit.nextWordAction,
407          "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
408         "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
409               "control A", DefaultEditorKit.selectAllAction,
410          "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
411                "HOME", DefaultEditorKit.beginLineAction,
412                 "END", DefaultEditorKit.endLineAction,
413              "shift HOME", DefaultEditorKit.selectionBeginLineAction,
414               "shift END", DefaultEditorKit.selectionEndLineAction,
415            "control HOME", DefaultEditorKit.beginAction,
416             "control END", DefaultEditorKit.endAction,
417          "control shift HOME", DefaultEditorKit.selectionBeginAction,
418           "control shift END", DefaultEditorKit.selectionEndAction,
419                  "UP", DefaultEditorKit.upAction,
420                "DOWN", DefaultEditorKit.downAction,
421                      "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
422                          "ctrl H", DefaultEditorKit.deletePrevCharAction,
423                          "DELETE", DefaultEditorKit.deleteNextCharAction,
424                           "RIGHT", DefaultEditorKit.forwardAction,
425                            "LEFT", DefaultEditorKit.backwardAction,
426                        "KP_RIGHT", DefaultEditorKit.forwardAction,
427                         "KP_LEFT", DefaultEditorKit.backwardAction,
428             "PAGE_UP", DefaultEditorKit.pageUpAction,
429               "PAGE_DOWN", DefaultEditorKit.pageDownAction,
430           "shift PAGE_UP", "selection-page-up",
431             "shift PAGE_DOWN", "selection-page-down",
432          "ctrl shift PAGE_UP", "selection-page-left",
433        "ctrl shift PAGE_DOWN", "selection-page-right",
434                "shift UP", DefaultEditorKit.selectionUpAction,
435              "shift DOWN", DefaultEditorKit.selectionDownAction,
436               "ENTER", DefaultEditorKit.insertBreakAction,
437                 "TAB", DefaultEditorKit.insertTabAction,
438                       "control T", "next-link-action",
439                 "control shift T", "previous-link-action",
440                   "control SPACE", "activate-link-action",
441                 "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
442     });
443
444     Object JavaDoc menuItemAcceleratorDelimiter = new String JavaDoc("+");
445
446     Object JavaDoc ControlBackgroundColor = new DesktopProperty(
447                                                        "win.3d.backgroundColor",
448                                 table.get("control"),
449                                                        toolkit);
450     Object JavaDoc ControlLightColor = new DesktopProperty(
451                                                        "win.3d.lightColor",
452                             table.get("controlHighlight"),
453                                                        toolkit);
454     Object JavaDoc ControlHighlightColor = new DesktopProperty(
455                                                        "win.3d.highlightColor",
456                             table.get("controlLtHighlight"),
457                                                        toolkit);
458     Object JavaDoc ControlShadowColor = new DesktopProperty(
459                                                        "win.3d.shadowColor",
460                             table.get("controlShadow"),
461                                                        toolkit);
462     Object JavaDoc ControlDarkShadowColor = new DesktopProperty(
463                                                        "win.3d.darkShadowColor",
464                             table.get("controlDkShadow"),
465                                                        toolkit);
466     Object JavaDoc ControlTextColor = new DesktopProperty(
467                                                        "win.button.textColor",
468                             table.get("controlText"),
469                                                        toolkit);
470     Object JavaDoc MenuBackgroundColor = new DesktopProperty(
471                                                        "win.menu.backgroundColor",
472                             table.get("menu"),
473                                                        toolkit);
474     Object JavaDoc MenuBarBackgroundColor = new DesktopProperty(
475                                                        "win.menubar.backgroundColor",
476                             table.get("menu"),
477                                                        toolkit);
478     Object JavaDoc MenuTextColor = new DesktopProperty(
479                                                        "win.menu.textColor",
480                             table.get("menuText"),
481                                                        toolkit);
482     Object JavaDoc SelectionBackgroundColor = new DesktopProperty(
483                                                        "win.item.highlightColor",
484                             table.get("textHighlight"),
485                                                        toolkit);
486     Object JavaDoc SelectionTextColor = new DesktopProperty(
487                                                        "win.item.highlightTextColor",
488                             table.get("textHighlightText"),
489                                                        toolkit);
490     Object JavaDoc WindowBackgroundColor = new DesktopProperty(
491                                                        "win.frame.backgroundColor",
492                             table.get("window"),
493                                                        toolkit);
494     Object JavaDoc WindowTextColor = new DesktopProperty(
495                                                        "win.frame.textColor",
496                             table.get("windowText"),
497                                                        toolkit);
498         Object JavaDoc WindowBorderWidth = new DesktopProperty(
499                                                        "win.frame.sizingBorderWidth",
500                                                        new Integer JavaDoc(1),
501                                                        toolkit);
502         Object JavaDoc TitlePaneHeight = new DesktopProperty(
503                                                        "win.frame.captionHeight",
504                                                        new Integer JavaDoc(18),
505                                                        toolkit);
506         Object JavaDoc TitleButtonWidth = new DesktopProperty(
507                                                        "win.frame.captionButtonWidth",
508                                                        new Integer JavaDoc(16),
509                                                        toolkit);
510         Object JavaDoc TitleButtonHeight = new DesktopProperty(
511                                                        "win.frame.captionButtonHeight",
512                                                        new Integer JavaDoc(16),
513                                                        toolkit);
514     Object JavaDoc InactiveTextColor = new DesktopProperty(
515                                                        "win.text.grayedTextColor",
516                             table.get("textInactiveText"),
517                                                        toolkit);
518     Object JavaDoc ScrollbarBackgroundColor = new DesktopProperty(
519                                                        "win.scrollbar.backgroundColor",
520                             table.get("scrollbar"),
521                                                        toolkit);
522
523         Object JavaDoc TextBackground = new XPColorValue(
524             Part.EP_EDIT, null, Prop.FILLCOLOR,
525             WindowBackgroundColor);
526         Object JavaDoc ReadOnlyTextBackground = new XPColorValue(
527             Part.EP_EDITTEXT, State.READONLY, Prop.FILLCOLOR,
528             ControlBackgroundColor);
529         Object JavaDoc DisabledTextBackground = new XPColorValue(
530             Part.EP_EDITTEXT, State.DISABLED, Prop.FILLCOLOR,
531             ControlBackgroundColor);
532
533         Object JavaDoc MenuFont = dialogPlain12;
534         Object JavaDoc FixedControlFont = monospacedPlain12;
535         Object JavaDoc ControlFont = dialogPlain12;
536         Object JavaDoc MessageFont = dialogPlain12;
537         Object JavaDoc WindowFont = dialogBold12;
538         Object JavaDoc ToolTipFont = sansSerifPlain12;
539     Object JavaDoc IconFont = ControlFont;
540
541     Object JavaDoc scrollBarWidth = new DesktopProperty("win.scrollbar.width",
542                             new Integer JavaDoc(16), toolkit);
543
544     Object JavaDoc showMnemonics = new DesktopProperty("win.menu.keyboardCuesOn",
545                              Boolean.TRUE, toolkit);
546
547         if (useSystemFontSettings) {
548             MenuFont = getDesktopFontValue("win.menu.font", MenuFont, toolkit);
549             FixedControlFont = getDesktopFontValue("win.ansiFixed.font",
550                                                    FixedControlFont, toolkit);
551             ControlFont = getDesktopFontValue("win.defaultGUI.font",
552                                               ControlFont, toolkit);
553             MessageFont = getDesktopFontValue("win.messagebox.font",
554                                               MessageFont, toolkit);
555             WindowFont = getDesktopFontValue("win.frame.captionFont",
556                                              WindowFont, toolkit);
557         IconFont = getDesktopFontValue("win.icon.font",
558                           IconFont, toolkit);
559             ToolTipFont = getDesktopFontValue("win.tooltip.font", ToolTipFont,
560                                               toolkit);
561         }
562         if (useSystemFontSizeSettings) {
563             MenuFont = new WindowsFontSizeProperty("win.menu.font.height",
564                                   toolkit, "Dialog", Font.PLAIN, 12);
565             FixedControlFont = new WindowsFontSizeProperty(
566                        "win.ansiFixed.font.height", toolkit, "MonoSpaced",
567                        Font.PLAIN, 12);
568             ControlFont = new WindowsFontSizeProperty(
569                         "win.defaultGUI.font.height", toolkit, "Dialog",
570                         Font.PLAIN, 12);
571             MessageFont = new WindowsFontSizeProperty(
572                               "win.messagebox.font.height",
573                               toolkit, "Dialog", Font.PLAIN, 12);
574             WindowFont = new WindowsFontSizeProperty(
575                              "win.frame.captionFont.height", toolkit,
576                              "Dialog", Font.BOLD, 12);
577             ToolTipFont = new WindowsFontSizeProperty(
578                               "win.tooltip.font.height", toolkit, "SansSerif",
579                               Font.PLAIN, 12);
580         IconFont = new WindowsFontSizeProperty(
581                   "win.icon.font.height", toolkit, "Dialog",
582                   Font.PLAIN, 12);
583         }
584
585
586     if (!(this instanceof WindowsClassicLookAndFeel) &&
587         (System.getProperty("os.name").startsWith("Windows ") &&
588          System.getProperty("os.version").compareTo("5.1") >= 0) &&
589         AccessController.doPrivileged(new GetPropertyAction("swing.noxp")) == null) {
590
591         // These desktop properties are not used directly, but are needed to
592
// trigger realoading of UI's.
593
this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive");
594         this.dllName = new TriggerDesktopProperty("win.xpstyle.dllName");
595         this.colorName = new TriggerDesktopProperty("win.xpstyle.colorName");
596         this.sizeName = new TriggerDesktopProperty("win.xpstyle.sizeName");
597     }
598
599
600         Object JavaDoc[] defaults = {
601         // *** Auditory Feedback
602
// this key defines which of the various cues to render
603
// Overridden from BasicL&F. This L&F should play all sounds
604
// all the time. The infrastructure decides what to play.
605
// This is disabled until sound bugs can be resolved.
606
"AuditoryCues.playList", null, // table.get("AuditoryCues.cueList"),
607

608         "Application.useSystemFontSettings", Boolean.valueOf(useSystemFontSettings),
609
610         "TextField.focusInputMap", fieldInputMap,
611         "PasswordField.focusInputMap", passwordInputMap,
612         "TextArea.focusInputMap", multilineInputMap,
613         "TextPane.focusInputMap", multilineInputMap,
614         "EditorPane.focusInputMap", multilineInputMap,
615
616         // Buttons
617
"Button.font", ControlFont,
618         "Button.background", ControlBackgroundColor,
619         "Button.foreground", ControlTextColor,
620         "Button.shadow", ControlShadowColor,
621             "Button.darkShadow", ControlDarkShadowColor,
622             "Button.light", ControlLightColor,
623             "Button.highlight", ControlHighlightColor,
624         "Button.disabledForeground", InactiveTextColor,
625         "Button.disabledShadow", ControlHighlightColor,
626             "Button.focus", black,
627         "Button.dashedRectGapX", new Integer JavaDoc(5),
628         "Button.dashedRectGapY", new Integer JavaDoc(4),
629         "Button.dashedRectGapWidth", new Integer JavaDoc(10),
630         "Button.dashedRectGapHeight", new Integer JavaDoc(8),
631         "Button.textShiftOffset", new Integer JavaDoc(1),
632         // W2K keyboard navigation hidding.
633
"Button.showMnemonics", showMnemonics,
634             "Button.focusInputMap",
635                new UIDefaults.LazyInputMap(new Object JavaDoc[] {
636                             "SPACE", "pressed",
637                    "released SPACE", "released"
638                  }),
639
640         "CheckBox.font", ControlFont,
641             "CheckBox.interiorBackground", WindowBackgroundColor,
642         "CheckBox.background", ControlBackgroundColor,
643         "CheckBox.foreground", ControlTextColor,
644             "CheckBox.shadow", ControlShadowColor,
645             "CheckBox.darkShadow", ControlDarkShadowColor,
646             "CheckBox.light", ControlLightColor,
647             "CheckBox.highlight", ControlHighlightColor,
648             "CheckBox.focus", black,
649         "CheckBox.focusInputMap",
650            new UIDefaults.LazyInputMap(new Object JavaDoc[] {
651                     "SPACE", "pressed",
652                    "released SPACE", "released"
653          }),
654
655             "CheckBoxMenuItem.font", MenuFont,
656         "CheckBoxMenuItem.background", MenuBackgroundColor,
657         "CheckBoxMenuItem.foreground", MenuTextColor,
658         "CheckBoxMenuItem.selectionForeground", SelectionTextColor,
659         "CheckBoxMenuItem.selectionBackground", SelectionBackgroundColor,
660         "CheckBoxMenuItem.acceleratorForeground", MenuTextColor,
661         "CheckBoxMenuItem.acceleratorSelectionForeground", SelectionTextColor,
662         "CheckBoxMenuItem.commandSound", "win.sound.menuCommand",
663
664         "ComboBox.font", ControlFont,
665         "ComboBox.background", WindowBackgroundColor,
666         "ComboBox.foreground", WindowTextColor,
667         "ComboBox.buttonBackground", ControlBackgroundColor,
668         "ComboBox.buttonShadow", ControlShadowColor,
669         "ComboBox.buttonDarkShadow", ControlDarkShadowColor,
670         "ComboBox.buttonHighlight", ControlHighlightColor,
671             "ComboBox.selectionBackground", SelectionBackgroundColor,
672             "ComboBox.selectionForeground", SelectionTextColor,
673             "ComboBox.disabledBackground", ControlBackgroundColor,
674             "ComboBox.disabledForeground", InactiveTextColor,
675         "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object JavaDoc[] {
676            "ESCAPE", "hidePopup",
677           "PAGE_UP", "pageUpPassThrough",
678         "PAGE_DOWN", "pageDownPassThrough",
679              "HOME", "homePassThrough",
680               "END", "endPassThrough",
681              "DOWN", "selectNext2",
682           "KP_DOWN", "selectNext2",
683                "UP", "selectPrevious2",
684             "KP_UP", "selectPrevious2",
685            "ENTER", "enterPressed",
686                "F4", "togglePopup"
687           }),
688
689         // DeskTop.
690
"Desktop.background", new DesktopProperty(
691                                                  "win.desktop.backgroundColor",
692                           table.get("desktop"),
693                                                  toolkit),
694         "Desktop.ancestorInputMap",
695            new UIDefaults.LazyInputMap(new Object JavaDoc[] {
696            "ctrl F5", "restore",
697            "ctrl F4", "close",
698            "ctrl F7", "move",
699            "ctrl F8", "resize",
700            "RIGHT", "right",
701            "KP_RIGHT", "right",
702            "LEFT", "left",
703            "KP_LEFT", "left",
704            "UP", "up",
705            "KP_UP", "up",
706            "DOWN", "down",
707            "KP_DOWN", "down",
708            "ESCAPE", "escape",
709            "ctrl F9", "minimize",
710            "ctrl F10", "maximize",
711            "ctrl F6", "selectNextFrame",
712            "ctrl TAB", "selectNextFrame",
713            "ctrl alt F6", "selectNextFrame",
714            "shift ctrl alt F6", "selectPreviousFrame",
715                    "ctrl F12", "navigateNext",
716                    "shift ctrl F12", "navigatePrevious"
717            }),
718
719             // DesktopIcon
720
"DesktopIcon.width", new Integer JavaDoc(160),
721
722         "EditorPane.font", ControlFont,
723         "EditorPane.background", WindowBackgroundColor,
724         "EditorPane.foreground", WindowTextColor,
725         "EditorPane.selectionBackground", SelectionBackgroundColor,
726         "EditorPane.selectionForeground", SelectionTextColor,
727         "EditorPane.caretForeground", WindowTextColor,
728         "EditorPane.inactiveForeground", InactiveTextColor,
729
730         "FileChooser.homeFolderIcon", new LazyWindowsIcon(null,
731                                    "icons/HomeFolder.gif"),
732         "FileChooser.listFont", IconFont,
733             "FileChooser.listViewBackground", new XPColorValue(
734                 Part.LVP_LISTVIEW, null, Prop.FILLCOLOR,
735                 WindowBackgroundColor),
736             "FileChooser.listViewBorder", new XPBorderValue(Part.LVP_LISTVIEW,
737                           new SwingLazyValue(
738                             "javax.swing.plaf.BorderUIResource",
739                             "getLoweredBevelBorderUIResource")),
740         "FileChooser.listViewIcon", new LazyWindowsIcon("fileChooserIcon ListView",
741                                    "icons/ListView.gif"),
742         "FileChooser.listViewWindowsStyle", Boolean.TRUE,
743         "FileChooser.detailsViewIcon", new LazyWindowsIcon("fileChooserIcon DetailsView",
744                                    "icons/DetailsView.gif"),
745         "FileChooser.upFolderIcon", new LazyWindowsIcon("fileChooserIcon UpFolder",
746                                    "icons/UpFolder.gif"),
747         "FileChooser.newFolderIcon", new LazyWindowsIcon("fileChooserIcon NewFolder",
748                                    "icons/NewFolder.gif"),
749         "FileChooser.useSystemExtensionHiding", Boolean.TRUE,
750
751             "FileChooser.lookInLabelMnemonic", new Integer JavaDoc(KeyEvent.VK_I),
752             "FileChooser.fileNameLabelMnemonic", new Integer JavaDoc(KeyEvent.VK_N),
753             "FileChooser.filesOfTypeLabelMnemonic", new Integer JavaDoc(KeyEvent.VK_T),
754         "FileChooser.usesSingleFilePane", Boolean.TRUE,
755         "FileChooser.ancestorInputMap",
756            new UIDefaults.LazyInputMap(new Object JavaDoc[] {
757              "ESCAPE", "cancelSelection",
758              "F2", "editFileName",
759              "F5", "refresh",
760              "BACK_SPACE", "Go Up",
761              "ENTER", "approveSelection"
762          }),
763
764             "FileView.directoryIcon", SwingUtilities2.makeIcon(getClass(),
765                                                                WindowsLookAndFeel.class,
766                                                                "icons/Directory.gif"),
767             "FileView.fileIcon", SwingUtilities2.makeIcon(getClass(),
768                                                           WindowsLookAndFeel.class,
769                                                           "icons/File.gif"),
770             "FileView.computerIcon", SwingUtilities2.makeIcon(getClass(),
771                                                               WindowsLookAndFeel.class,
772                                                               "icons/Computer.gif"),
773             "FileView.hardDriveIcon", SwingUtilities2.makeIcon(getClass(),
774                                                                WindowsLookAndFeel.class,
775                                                                "icons/HardDrive.gif"),
776             "FileView.floppyDriveIcon", SwingUtilities2.makeIcon(getClass(),
777                                                                  WindowsLookAndFeel.class,
778                                                                  "icons/FloppyDrive.gif"),
779
780             "InternalFrame.titleFont", WindowFont,
781             "InternalFrame.titlePaneHeight", TitlePaneHeight,
782             "InternalFrame.titleButtonWidth", TitleButtonWidth,
783             "InternalFrame.titleButtonHeight", TitleButtonHeight,
784         "InternalFrame.borderColor", ControlBackgroundColor,
785         "InternalFrame.borderShadow", ControlShadowColor,
786         "InternalFrame.borderDarkShadow", ControlDarkShadowColor,
787         "InternalFrame.borderHighlight", ControlHighlightColor,
788         "InternalFrame.borderLight", ControlLightColor,
789             "InternalFrame.borderWidth", WindowBorderWidth,
790             "InternalFrame.minimizeIconBackground", ControlBackgroundColor,
791             "InternalFrame.resizeIconHighlight", ControlLightColor,
792             "InternalFrame.resizeIconShadow", ControlShadowColor,
793             "InternalFrame.activeBorderColor", new DesktopProperty(
794                                                        "win.frame.activeBorderColor",
795                                                        table.get("windowBorder"),
796                                                        toolkit),
797             "InternalFrame.inactiveBorderColor", new DesktopProperty(
798                                                        "win.frame.inactiveBorderColor",
799                                                        table.get("windowBorder"),
800                                                        toolkit),
801         "InternalFrame.activeTitleBackground", new DesktopProperty(
802                                                         "win.frame.activeCaptionColor",
803                              table.get("activeCaption"),
804                                                         toolkit),
805         "InternalFrame.activeTitleGradient", new DesktopProperty(
806                                                 "win.frame.activeCaptionGradientColor",
807                              table.get("activeCaption"),
808                                                         toolkit),
809         "InternalFrame.activeTitleForeground", new DesktopProperty(
810                                                         "win.frame.captionTextColor",
811                              table.get("activeCaptionText"),
812                                                         toolkit),
813         "InternalFrame.inactiveTitleBackground", new DesktopProperty(
814                                                         "win.frame.inactiveCaptionColor",
815                              table.get("inactiveCaption"),
816                                                         toolkit),
817         "InternalFrame.inactiveTitleGradient", new DesktopProperty(
818                                                         "win.frame.inactiveCaptionGradientColor",
819                              table.get("inactiveCaption"),
820                                                         toolkit),
821         "InternalFrame.inactiveTitleForeground", new DesktopProperty(
822                                                         "win.frame.inactiveCaptionTextColor",
823                              table.get("inactiveCaptionText"),
824                                                         toolkit),
825             
826             "InternalFrame.maximizeIcon",
827                 WindowsIconFactory.createFrameMaximizeIcon(),
828             "InternalFrame.minimizeIcon",
829                 WindowsIconFactory.createFrameMinimizeIcon(),
830             "InternalFrame.iconifyIcon",
831                 WindowsIconFactory.createFrameIconifyIcon(),
832             "InternalFrame.closeIcon",
833                 WindowsIconFactory.createFrameCloseIcon(),
834             "InternalFrame.icon",
835         new SwingLazyValue(
836     "com.sun.java.swing.plaf.windows.WindowsInternalFrameTitlePane$ScalableIconUIResource",
837             // The constructor takes one arg: an array of UIDefaults.LazyValue
838
// representing the icons
839
new Object JavaDoc[][] { {
840                         SwingUtilities2.makeIcon(getClass(), BasicLookAndFeel.class, "icons/JavaCup16.png"),
841                         SwingUtilities2.makeIcon(getClass(), WindowsLookAndFeel.class, "icons/JavaCup32.png")
842             } }),
843
844         // Internal Frame Auditory Cue Mappings
845
"InternalFrame.closeSound", "win.sound.close",
846             "InternalFrame.maximizeSound", "win.sound.maximize",
847             "InternalFrame.minimizeSound", "win.sound.minimize",
848             "InternalFrame.restoreDownSound", "win.sound.restoreDown",
849             "InternalFrame.restoreUpSound", "win.sound.restoreUp",
850
851         "InternalFrame.windowBindings", new Object JavaDoc[] {
852         "shift ESCAPE", "showSystemMenu",
853           "ctrl SPACE", "showSystemMenu",
854               "ESCAPE", "hideSystemMenu"},
855         
856         // Label
857
"Label.font", ControlFont,
858         "Label.background", ControlBackgroundColor,
859         "Label.foreground", ControlTextColor,
860         "Label.disabledForeground", InactiveTextColor,
861         "Label.disabledShadow", ControlHighlightColor,
862
863         // List.
864
"List.font", ControlFont,
865         "List.background", WindowBackgroundColor,
866         "List.foreground", WindowTextColor,
867         "List.selectionBackground", SelectionBackgroundColor,
868         "List.selectionForeground", SelectionTextColor,
869         "List.lockToPositionOnScroll", Boolean.TRUE,
870         "List.focusInputMap",
871            new UIDefaults.LazyInputMap(new Object JavaDoc[] {
872                            "ctrl C", "copy",
873                            "ctrl V", "paste",
874                            "ctrl X", "cut",
875                              "COPY", "copy",
876                             "PASTE", "paste",
877                               "CUT", "cut",
878                        "UP", "selectPreviousRow",
879                     "KP_UP", "selectPreviousRow",
880                  "shift UP", "selectPreviousRowExtendSelection",
881               "shift KP_UP", "selectPreviousRowExtendSelection",
882                     "ctrl shift UP", "selectPreviousRowExtendSelection",
883                  "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
884                           "ctrl UP", "selectPreviousRowChangeLead",
885                        "ctrl KP_UP", "selectPreviousRowChangeLead",
886                      "DOWN", "selectNextRow",
887                   "KP_DOWN", "selectNextRow",
888                "shift DOWN", "selectNextRowExtendSelection",
889             "shift KP_DOWN", "selectNextRowExtendSelection",
890                   "ctrl shift DOWN", "selectNextRowExtendSelection",
891                "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
892                         "ctrl DOWN", "selectNextRowChangeLead",
893                      "ctrl KP_DOWN", "selectNextRowChangeLead",
894                      "LEFT", "selectPreviousColumn",
895                   "KP_LEFT", "selectPreviousColumn",
896                "shift LEFT", "selectPreviousColumnExtendSelection",
897             "shift KP_LEFT", "selectPreviousColumnExtendSelection",
898                   "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
899                "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
900                         "ctrl LEFT", "selectPreviousColumnChangeLead",
901                      "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
902                     "RIGHT", "selectNextColumn",
903                  "KP_RIGHT", "selectNextColumn",
904               "shift RIGHT", "selectNextColumnExtendSelection",
905            "shift KP_RIGHT", "selectNextColumnExtendSelection",
906                  "ctrl shift RIGHT", "selectNextColumnExtendSelection",
907               "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
908                        "ctrl RIGHT", "selectNextColumnChangeLead",
909                     "ctrl KP_RIGHT", "selectNextColumnChangeLead",
910                      "HOME", "selectFirstRow",
911                "shift HOME", "selectFirstRowExtendSelection",
912                   "ctrl shift HOME", "selectFirstRowExtendSelection",
913                         "ctrl HOME", "selectFirstRowChangeLead",
914                       "END", "selectLastRow",
915                 "shift END", "selectLastRowExtendSelection",
916                    "ctrl shift END", "selectLastRowExtendSelection",
917                          "ctrl END", "selectLastRowChangeLead",
918                   "PAGE_UP", "scrollUp",
919             "shift PAGE_UP", "scrollUpExtendSelection",
920                "ctrl shift PAGE_UP", "scrollUpExtendSelection",
921                      "ctrl PAGE_UP", "scrollUpChangeLead",
922                 "PAGE_DOWN", "scrollDown",
923           "shift PAGE_DOWN", "scrollDownExtendSelection",
924              "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
925                    "ctrl PAGE_DOWN", "scrollDownChangeLead",
926                    "ctrl A", "selectAll",
927                "ctrl SLASH", "selectAll",
928           "ctrl BACK_SLASH", "clearSelection",
929                             "SPACE", "addToSelection",
930                        "ctrl SPACE", "toggleAndAnchor",
931                       "shift SPACE", "extendTo",
932                  "ctrl shift SPACE", "moveSelectionTo"
933          }),
934
935         // PopupMenu
936
"PopupMenu.font", MenuFont,
937         "PopupMenu.background", MenuBackgroundColor,
938         "PopupMenu.foreground", MenuTextColor,
939             "PopupMenu.popupSound", "win.sound.menuPopup",
940
941         // Menus
942
"Menu.font", MenuFont,
943             "Menu.foreground", MenuTextColor,
944             "Menu.background", MenuBackgroundColor,
945         "Menu.useMenuBarBackgroundForTopLevel", Boolean.TRUE,
946             "Menu.selectionForeground", SelectionTextColor,
947             "Menu.selectionBackground", SelectionBackgroundColor,
948         "Menu.acceleratorForeground", MenuTextColor,
949         "Menu.acceleratorSelectionForeground", SelectionTextColor,
950         "Menu.menuPopupOffsetX", new Integer JavaDoc(0),
951         "Menu.menuPopupOffsetY", new Integer JavaDoc(0),
952         "Menu.submenuPopupOffsetX", new Integer JavaDoc(-4),
953         "Menu.submenuPopupOffsetY", new Integer JavaDoc(-3),
954             "Menu.crossMenuMnemonic", Boolean.FALSE,
955
956         // MenuBar.
957
"MenuBar.font", MenuFont,
958         "MenuBar.background", new XPValue(MenuBarBackgroundColor,
959                           MenuBackgroundColor),
960         "MenuBar.foreground", MenuTextColor,
961         "MenuBar.shadow", ControlShadowColor,
962         "MenuBar.highlight", ControlHighlightColor,
963         "MenuBar.windowBindings", new Object JavaDoc[] {
964         "F10", "takeFocus" },
965
966             "MenuItem.font", MenuFont,
967             "MenuItem.acceleratorFont", MenuFont,
968             "MenuItem.foreground", MenuTextColor,
969             "MenuItem.background", MenuBackgroundColor,
970             "MenuItem.selectionForeground", SelectionTextColor,
971             "MenuItem.selectionBackground", SelectionBackgroundColor,
972         "MenuItem.disabledForeground", InactiveTextColor,
973         "MenuItem.acceleratorForeground", MenuTextColor,
974         "MenuItem.acceleratorSelectionForeground", SelectionTextColor,
975         "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
976              // Menu Item Auditory Cue Mapping
977
"MenuItem.commandSound", "win.sound.menuCommand",
978
979         "RadioButton.font", ControlFont,
980             "RadioButton.interiorBackground", WindowBackgroundColor,
981             "RadioButton.background", ControlBackgroundColor,
982         "RadioButton.foreground", ControlTextColor,
983             "RadioButton.shadow", ControlShadowColor,
984             "RadioButton.darkShadow", ControlDarkShadowColor,
985             "RadioButton.light", ControlLightColor,
986         "RadioButton.highlight", ControlHighlightColor,
987             "RadioButton.focus", black,
988         "RadioButton.focusInputMap",
989            new UIDefaults.LazyInputMap(new Object JavaDoc[] {
990                           "SPACE", "pressed",
991                  "released SPACE", "released"
992           }),
993
994
995             "RadioButtonMenuItem.font", MenuFont,
996         "RadioButtonMenuItem.foreground", MenuTextColor,
997         "RadioButtonMenuItem.background", MenuBackgroundColor,
998         "RadioButtonMenuItem.selectionForeground", SelectionTextColor,
999         "RadioButtonMenuItem.selectionBackground", SelectionBackgroundColor,
1000        "RadioButtonMenuItem.disabledForeground", InactiveTextColor,
1001        "RadioButtonMenuItem.acceleratorForeground", MenuTextColor,
1002        "RadioButtonMenuItem.acceleratorSelectionForeground", SelectionTextColor,
1003        "RadioButtonMenuItem.commandSound", "win.sound.menuCommand",
1004
1005        // OptionPane.
1006
"OptionPane.font", MessageFont,
1007        "OptionPane.messageFont", MessageFont,
1008        "OptionPane.buttonFont", MessageFont,
1009        "OptionPane.background", ControlBackgroundColor,
1010        "OptionPane.foreground", ControlTextColor,
1011            "OptionPane.messageForeground", ControlTextColor,
1012        "OptionPane.errorIcon", new LazyWindowsIcon("optionPaneIcon Error",
1013                                  "icons/Error.gif"),
1014        "OptionPane.informationIcon", new LazyWindowsIcon("optionPaneIcon Information",
1015                                  "icons/Inform.gif"),
1016        "OptionPane.questionIcon", new LazyWindowsIcon("optionPaneIcon Question",
1017                                  "icons/Question.gif"),
1018        "OptionPane.warningIcon", new LazyWindowsIcon("optionPaneIcon Warning",
1019                                  "icons/Warn.gif"),
1020        "OptionPane.windowBindings", new Object JavaDoc[] {
1021        "ESCAPE", "close" },
1022             // Option Pane Auditory Cue Mappings
1023
"OptionPane.errorSound", "win.sound.hand", // Error
1024
"OptionPane.informationSound", "win.sound.asterisk", // Info Plain
1025
"OptionPane.questionSound", "win.sound.question", // Question
1026
"OptionPane.warningSound", "win.sound.exclamation", // Warning
1027

1028            "FormattedTextField.focusInputMap",
1029              new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1030               "ctrl C", DefaultEditorKit.copyAction,
1031               "ctrl V", DefaultEditorKit.pasteAction,
1032               "ctrl X", DefaultEditorKit.cutAction,
1033                 "COPY", DefaultEditorKit.copyAction,
1034                "PASTE", DefaultEditorKit.pasteAction,
1035                  "CUT", DefaultEditorKit.cutAction,
1036               "shift LEFT", DefaultEditorKit.selectionBackwardAction,
1037                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
1038              "shift RIGHT", DefaultEditorKit.selectionForwardAction,
1039           "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
1040            "ctrl LEFT", DefaultEditorKit.previousWordAction,
1041             "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
1042               "ctrl RIGHT", DefaultEditorKit.nextWordAction,
1043            "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
1044          "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
1045           "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
1046         "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
1047          "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
1048               "ctrl A", DefaultEditorKit.selectAllAction,
1049                 "HOME", DefaultEditorKit.beginLineAction,
1050                  "END", DefaultEditorKit.endLineAction,
1051               "shift HOME", DefaultEditorKit.selectionBeginLineAction,
1052                "shift END", DefaultEditorKit.selectionEndLineAction,
1053                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
1054                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
1055                           "DELETE", DefaultEditorKit.deleteNextCharAction,
1056                            "RIGHT", DefaultEditorKit.forwardAction,
1057                             "LEFT", DefaultEditorKit.backwardAction,
1058                         "KP_RIGHT", DefaultEditorKit.forwardAction,
1059                          "KP_LEFT", DefaultEditorKit.backwardAction,
1060                "ENTER", JTextField.notifyAction,
1061          "ctrl BACK_SLASH", "unselect",
1062                   "control shift O", "toggle-componentOrientation",
1063                           "ESCAPE", "reset-field-edit",
1064                               "UP", "increment",
1065                            "KP_UP", "increment",
1066                             "DOWN", "decrement",
1067                          "KP_DOWN", "decrement",
1068              }),
1069
1070        // *** Panel
1071
"Panel.font", ControlFont,
1072        "Panel.background", ControlBackgroundColor,
1073        "Panel.foreground", WindowTextColor,
1074
1075        // *** PasswordField
1076
"PasswordField.font", FixedControlFont,
1077        "PasswordField.background", TextBackground,
1078        "PasswordField.foreground", WindowTextColor,
1079        "PasswordField.inactiveForeground", InactiveTextColor, // for disabled
1080
"PasswordField.inactiveBackground", ReadOnlyTextBackground, // for readonly
1081
"PasswordField.disabledBackground", DisabledTextBackground, // for disabled
1082
"PasswordField.selectionBackground", SelectionBackgroundColor,
1083        "PasswordField.selectionForeground", SelectionTextColor,
1084        "PasswordField.caretForeground",WindowTextColor,
1085
1086        // *** ProgressBar
1087
"ProgressBar.font", ControlFont,
1088        "ProgressBar.foreground", SelectionBackgroundColor,
1089        "ProgressBar.background", ControlBackgroundColor,
1090        "ProgressBar.shadow", ControlShadowColor,
1091        "ProgressBar.highlight", ControlHighlightColor,
1092        "ProgressBar.selectionForeground", ControlBackgroundColor,
1093        "ProgressBar.selectionBackground", SelectionBackgroundColor,
1094            "ProgressBar.cellLength", new Integer JavaDoc(7),
1095            "ProgressBar.cellSpacing", new Integer JavaDoc(2),
1096
1097        // *** RootPane.
1098
// These bindings are only enabled when there is a default
1099
// button set on the rootpane.
1100
"RootPane.defaultButtonWindowKeyBindings", new Object JavaDoc[] {
1101                     "ENTER", "press",
1102            "released ENTER", "release",
1103                "ctrl ENTER", "press",
1104           "ctrl released ENTER", "release"
1105          },
1106
1107        // *** ScrollBar.
1108
"ScrollBar.background", ScrollbarBackgroundColor,
1109        "ScrollBar.foreground", ControlBackgroundColor,
1110        "ScrollBar.track", white,
1111        "ScrollBar.trackForeground", ScrollbarBackgroundColor,
1112        "ScrollBar.trackHighlight", black,
1113        "ScrollBar.trackHighlightForeground", scrollBarTrackHighlight,
1114        "ScrollBar.thumb", ControlBackgroundColor,
1115        "ScrollBar.thumbHighlight", ControlHighlightColor,
1116        "ScrollBar.thumbDarkShadow", ControlDarkShadowColor,
1117        "ScrollBar.thumbShadow", ControlShadowColor,
1118            "ScrollBar.width", scrollBarWidth,
1119        "ScrollBar.ancestorInputMap",
1120           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1121               "RIGHT", "positiveUnitIncrement",
1122            "KP_RIGHT", "positiveUnitIncrement",
1123                "DOWN", "positiveUnitIncrement",
1124             "KP_DOWN", "positiveUnitIncrement",
1125           "PAGE_DOWN", "positiveBlockIncrement",
1126          "ctrl PAGE_DOWN", "positiveBlockIncrement",
1127                "LEFT", "negativeUnitIncrement",
1128             "KP_LEFT", "negativeUnitIncrement",
1129                  "UP", "negativeUnitIncrement",
1130               "KP_UP", "negativeUnitIncrement",
1131             "PAGE_UP", "negativeBlockIncrement",
1132            "ctrl PAGE_UP", "negativeBlockIncrement",
1133                "HOME", "minScroll",
1134                 "END", "maxScroll"
1135         }),
1136
1137        // *** ScrollPane.
1138
"ScrollPane.font", ControlFont,
1139        "ScrollPane.background", ControlBackgroundColor,
1140        "ScrollPane.foreground", ControlTextColor,
1141        "ScrollPane.ancestorInputMap",
1142           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1143                   "RIGHT", "unitScrollRight",
1144                "KP_RIGHT", "unitScrollRight",
1145                    "DOWN", "unitScrollDown",
1146                 "KP_DOWN", "unitScrollDown",
1147                    "LEFT", "unitScrollLeft",
1148                 "KP_LEFT", "unitScrollLeft",
1149                      "UP", "unitScrollUp",
1150                   "KP_UP", "unitScrollUp",
1151                 "PAGE_UP", "scrollUp",
1152               "PAGE_DOWN", "scrollDown",
1153            "ctrl PAGE_UP", "scrollLeft",
1154          "ctrl PAGE_DOWN", "scrollRight",
1155               "ctrl HOME", "scrollHome",
1156                "ctrl END", "scrollEnd"
1157         }),
1158
1159        // *** Separator
1160
"Separator.background", ControlHighlightColor,
1161            "Separator.foreground", ControlShadowColor,
1162
1163        // *** Slider.
1164
"Slider.foreground", ControlBackgroundColor,
1165        "Slider.background", ControlBackgroundColor,
1166        "Slider.highlight", ControlHighlightColor,
1167        "Slider.shadow", ControlShadowColor,
1168        "Slider.focus", ControlDarkShadowColor,
1169        "Slider.focusInputMap",
1170           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1171               "RIGHT", "positiveUnitIncrement",
1172            "KP_RIGHT", "positiveUnitIncrement",
1173                "DOWN", "negativeUnitIncrement",
1174             "KP_DOWN", "negativeUnitIncrement",
1175           "PAGE_DOWN", "negativeBlockIncrement",
1176                "LEFT", "negativeUnitIncrement",
1177             "KP_LEFT", "negativeUnitIncrement",
1178                  "UP", "positiveUnitIncrement",
1179               "KP_UP", "positiveUnitIncrement",
1180             "PAGE_UP", "positiveBlockIncrement",
1181                "HOME", "minScroll",
1182                 "END", "maxScroll"
1183         }),
1184
1185            // Spinner
1186
"Spinner.font", FixedControlFont,
1187            "Spinner.ancestorInputMap",
1188           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1189                               "UP", "increment",
1190                            "KP_UP", "increment",
1191                             "DOWN", "decrement",
1192                          "KP_DOWN", "decrement",
1193               }),
1194
1195        // *** SplitPane
1196
"SplitPane.background", ControlBackgroundColor,
1197            "SplitPane.highlight", ControlHighlightColor,
1198            "SplitPane.shadow", ControlShadowColor,
1199        "SplitPane.darkShadow", ControlDarkShadowColor,
1200        "SplitPane.dividerSize", new Integer JavaDoc(5),
1201        "SplitPane.ancestorInputMap",
1202           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1203                "UP", "negativeIncrement",
1204              "DOWN", "positiveIncrement",
1205              "LEFT", "negativeIncrement",
1206             "RIGHT", "positiveIncrement",
1207             "KP_UP", "negativeIncrement",
1208           "KP_DOWN", "positiveIncrement",
1209           "KP_LEFT", "negativeIncrement",
1210          "KP_RIGHT", "positiveIncrement",
1211              "HOME", "selectMin",
1212               "END", "selectMax",
1213                "F8", "startResize",
1214                "F6", "toggleFocus",
1215          "ctrl TAB", "focusOutForward",
1216        "ctrl shift TAB", "focusOutBackward"
1217           }),
1218
1219        // *** TabbedPane
1220
"TabbedPane.tabsOverlapBorder", new XPValue(Boolean.TRUE, Boolean.FALSE),
1221        "TabbedPane.tabInsets", new XPValue(new InsetsUIResource(1, 4, 1, 4),
1222                            new InsetsUIResource(0, 4, 1, 4)),
1223        "TabbedPane.tabAreaInsets", new XPValue(new InsetsUIResource(3, 2, 2, 2),
1224                            new InsetsUIResource(3, 2, 0, 2)),
1225            "TabbedPane.font", ControlFont,
1226            "TabbedPane.background", ControlBackgroundColor,
1227            "TabbedPane.foreground", ControlTextColor,
1228            "TabbedPane.highlight", ControlHighlightColor,
1229            "TabbedPane.light", ControlLightColor,
1230            "TabbedPane.shadow", ControlShadowColor,
1231            "TabbedPane.darkShadow", ControlDarkShadowColor,
1232            "TabbedPane.focus", ControlTextColor,
1233        "TabbedPane.focusInputMap",
1234          new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1235                 "RIGHT", "navigateRight",
1236                  "KP_RIGHT", "navigateRight",
1237                      "LEFT", "navigateLeft",
1238                   "KP_LEFT", "navigateLeft",
1239                        "UP", "navigateUp",
1240                     "KP_UP", "navigateUp",
1241                      "DOWN", "navigateDown",
1242                   "KP_DOWN", "navigateDown",
1243                 "ctrl DOWN", "requestFocusForVisibleComponent",
1244              "ctrl KP_DOWN", "requestFocusForVisibleComponent",
1245        }),
1246        "TabbedPane.ancestorInputMap",
1247           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1248                         "ctrl TAB", "navigateNext",
1249                   "ctrl shift TAB", "navigatePrevious",
1250           "ctrl PAGE_DOWN", "navigatePageDown",
1251                 "ctrl PAGE_UP", "navigatePageUp",
1252                      "ctrl UP", "requestFocus",
1253                   "ctrl KP_UP", "requestFocus",
1254         }),
1255
1256        // *** Table
1257
"Table.font", ControlFont,
1258        "Table.foreground", ControlTextColor, // cell text color
1259
"Table.background", WindowBackgroundColor, // cell background color
1260
"Table.highlight", ControlHighlightColor,
1261            "Table.light", ControlLightColor,
1262            "Table.shadow", ControlShadowColor,
1263            "Table.darkShadow", ControlDarkShadowColor,
1264        "Table.selectionForeground", SelectionTextColor,
1265        "Table.selectionBackground", SelectionBackgroundColor,
1266            "Table.gridColor", gray, // grid line color
1267
"Table.focusCellBackground", WindowBackgroundColor,
1268            "Table.focusCellForeground", ControlTextColor,
1269        "Table.ancestorInputMap",
1270           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1271                               "ctrl C", "copy",
1272                               "ctrl V", "paste",
1273                               "ctrl X", "cut",
1274                                 "COPY", "copy",
1275                                "PASTE", "paste",
1276                                  "CUT", "cut",
1277                                "RIGHT", "selectNextColumn",
1278                             "KP_RIGHT", "selectNextColumn",
1279                          "shift RIGHT", "selectNextColumnExtendSelection",
1280                       "shift KP_RIGHT", "selectNextColumnExtendSelection",
1281                     "ctrl shift RIGHT", "selectNextColumnExtendSelection",
1282                  "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
1283                           "ctrl RIGHT", "selectNextColumnChangeLead",
1284                        "ctrl KP_RIGHT", "selectNextColumnChangeLead",
1285                                 "LEFT", "selectPreviousColumn",
1286                              "KP_LEFT", "selectPreviousColumn",
1287                           "shift LEFT", "selectPreviousColumnExtendSelection",
1288                        "shift KP_LEFT", "selectPreviousColumnExtendSelection",
1289                      "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
1290                   "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
1291                            "ctrl LEFT", "selectPreviousColumnChangeLead",
1292                         "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
1293                                 "DOWN", "selectNextRow",
1294                              "KP_DOWN", "selectNextRow",
1295                           "shift DOWN", "selectNextRowExtendSelection",
1296                        "shift KP_DOWN", "selectNextRowExtendSelection",
1297                      "ctrl shift DOWN", "selectNextRowExtendSelection",
1298                   "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
1299                            "ctrl DOWN", "selectNextRowChangeLead",
1300                         "ctrl KP_DOWN", "selectNextRowChangeLead",
1301                                   "UP", "selectPreviousRow",
1302                                "KP_UP", "selectPreviousRow",
1303                             "shift UP", "selectPreviousRowExtendSelection",
1304                          "shift KP_UP", "selectPreviousRowExtendSelection",
1305                        "ctrl shift UP", "selectPreviousRowExtendSelection",
1306                     "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
1307                              "ctrl UP", "selectPreviousRowChangeLead",
1308                           "ctrl KP_UP", "selectPreviousRowChangeLead",
1309                                 "HOME", "selectFirstColumn",
1310                           "shift HOME", "selectFirstColumnExtendSelection",
1311                      "ctrl shift HOME", "selectFirstRowExtendSelection",
1312                            "ctrl HOME", "selectFirstRow",
1313                                  "END", "selectLastColumn",
1314                            "shift END", "selectLastColumnExtendSelection",
1315                       "ctrl shift END", "selectLastRowExtendSelection",
1316                             "ctrl END", "selectLastRow",
1317                              "PAGE_UP", "scrollUpChangeSelection",
1318                        "shift PAGE_UP", "scrollUpExtendSelection",
1319                   "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
1320                         "ctrl PAGE_UP", "scrollLeftChangeSelection",
1321                            "PAGE_DOWN", "scrollDownChangeSelection",
1322                      "shift PAGE_DOWN", "scrollDownExtendSelection",
1323                 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
1324                       "ctrl PAGE_DOWN", "scrollRightChangeSelection",
1325                                  "TAB", "selectNextColumnCell",
1326                            "shift TAB", "selectPreviousColumnCell",
1327                                "ENTER", "selectNextRowCell",
1328                          "shift ENTER", "selectPreviousRowCell",
1329                               "ctrl A", "selectAll",
1330                           "ctrl SLASH", "selectAll",
1331                      "ctrl BACK_SLASH", "clearSelection",
1332                               "ESCAPE", "cancel",
1333                                   "F2", "startEditing",
1334                                "SPACE", "addToSelection",
1335                           "ctrl SPACE", "toggleAndAnchor",
1336                          "shift SPACE", "extendTo",
1337                     "ctrl shift SPACE", "moveSelectionTo"
1338         }),
1339
1340        "TableHeader.font", ControlFont,
1341        "TableHeader.foreground", ControlTextColor, // header text color
1342
"TableHeader.background", ControlBackgroundColor, // header background
1343

1344        // *** TextArea
1345
"TextArea.font", FixedControlFont,
1346        "TextArea.background", WindowBackgroundColor,
1347        "TextArea.foreground", WindowTextColor,
1348        "TextArea.inactiveForeground", InactiveTextColor,
1349        "TextArea.selectionBackground", SelectionBackgroundColor,
1350        "TextArea.selectionForeground", SelectionTextColor,
1351        "TextArea.caretForeground", WindowTextColor,
1352
1353        // *** TextField
1354
"TextField.font", ControlFont,
1355        "TextField.background", TextBackground,
1356        "TextField.foreground", WindowTextColor,
1357        "TextField.shadow", ControlShadowColor,
1358        "TextField.darkShadow", ControlDarkShadowColor,
1359        "TextField.light", ControlLightColor,
1360        "TextField.highlight", ControlHighlightColor,
1361        "TextField.inactiveForeground", InactiveTextColor, // for disabled
1362
"TextField.inactiveBackground", ReadOnlyTextBackground, // for readonly
1363
"TextField.disabledBackground", DisabledTextBackground, // for disabled
1364
"TextField.selectionBackground", SelectionBackgroundColor,
1365        "TextField.selectionForeground", SelectionTextColor,
1366        "TextField.caretForeground", WindowTextColor,
1367
1368        // *** TextPane
1369
"TextPane.font", ControlFont,
1370        "TextPane.background", WindowBackgroundColor,
1371        "TextPane.foreground", WindowTextColor,
1372        "TextPane.selectionBackground", SelectionBackgroundColor,
1373        "TextPane.selectionForeground", SelectionTextColor,
1374        "TextPane.caretForeground", WindowTextColor,
1375
1376        // *** TitledBorder
1377
"TitledBorder.font", ControlFont,
1378            "TitledBorder.titleColor",
1379                        new XPColorValue(Part.BP_GROUPBOX, null, Prop.TEXTCOLOR,
1380                     ControlTextColor),
1381
1382        // *** ToggleButton
1383
"ToggleButton.font", ControlFont,
1384            "ToggleButton.background", ControlBackgroundColor,
1385            "ToggleButton.foreground", ControlTextColor,
1386        "ToggleButton.shadow", ControlShadowColor,
1387            "ToggleButton.darkShadow", ControlDarkShadowColor,
1388            "ToggleButton.light", ControlLightColor,
1389            "ToggleButton.highlight", ControlHighlightColor,
1390            "ToggleButton.focus", ControlTextColor,
1391        "ToggleButton.textShiftOffset", new Integer JavaDoc(1),
1392        "ToggleButton.focusInputMap",
1393          new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1394                    "SPACE", "pressed",
1395                   "released SPACE", "released"
1396            }),
1397
1398        // *** ToolBar
1399
"ToolBar.font", MenuFont,
1400        "ToolBar.background", ControlBackgroundColor,
1401        "ToolBar.foreground", ControlTextColor,
1402        "ToolBar.shadow", ControlShadowColor,
1403        "ToolBar.darkShadow", ControlDarkShadowColor,
1404        "ToolBar.light", ControlLightColor,
1405        "ToolBar.highlight", ControlHighlightColor,
1406        "ToolBar.dockingBackground", ControlBackgroundColor,
1407        "ToolBar.dockingForeground", red,
1408        "ToolBar.floatingBackground", ControlBackgroundColor,
1409        "ToolBar.floatingForeground", darkGray,
1410        "ToolBar.ancestorInputMap",
1411           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1412                "UP", "navigateUp",
1413             "KP_UP", "navigateUp",
1414              "DOWN", "navigateDown",
1415           "KP_DOWN", "navigateDown",
1416              "LEFT", "navigateLeft",
1417           "KP_LEFT", "navigateLeft",
1418             "RIGHT", "navigateRight",
1419          "KP_RIGHT", "navigateRight"
1420         }),
1421        "ToolBar.separatorSize", null,
1422
1423        // *** ToolTip
1424
"ToolTip.font", ToolTipFont,
1425            "ToolTip.background", new DesktopProperty(
1426                                           "win.tooltip.backgroundColor",
1427                        table.get("info"), toolkit),
1428            "ToolTip.foreground", new DesktopProperty(
1429                                           "win.tooltip.textColor",
1430                        table.get("infoText"), toolkit),
1431            // this is a workaround because we cannot directly override
1432
// BasicToolBarUI.getRolloverBorder() in an update release
1433
"ToolBar.rolloverBorderProvider", new BorderProvider() {
1434                    public Border getRolloverBorder(AbstractButton b) {
1435                        return WindowsToolBarUI.getRolloverBorder(b);
1436                    }
1437                },
1438
1439        // *** Tree
1440
"Tree.selectionBorderColor", black,
1441        "Tree.drawDashedFocusIndicator", Boolean.TRUE,
1442        "Tree.lineTypeDashed", Boolean.TRUE,
1443        "Tree.font", ControlFont,
1444        "Tree.background", WindowBackgroundColor,
1445            "Tree.foreground", WindowTextColor,
1446        "Tree.hash", gray,
1447        "Tree.textForeground", WindowTextColor,
1448        "Tree.textBackground", WindowBackgroundColor,
1449        "Tree.selectionForeground", SelectionTextColor,
1450        "Tree.selectionBackground", SelectionBackgroundColor,
1451            "Tree.expandedIcon", treeExpandedIcon,
1452            "Tree.collapsedIcon", treeCollapsedIcon,
1453        "Tree.focusInputMap",
1454           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1455                                    "ADD", "expand",
1456                               "SUBTRACT", "collapse",
1457                                 "ctrl C", "copy",
1458                                 "ctrl V", "paste",
1459                                 "ctrl X", "cut",
1460                                   "COPY", "copy",
1461                                  "PASTE", "paste",
1462                                    "CUT", "cut",
1463                             "UP", "selectPrevious",
1464                          "KP_UP", "selectPrevious",
1465                       "shift UP", "selectPreviousExtendSelection",
1466                    "shift KP_UP", "selectPreviousExtendSelection",
1467                          "ctrl shift UP", "selectPreviousExtendSelection",
1468                       "ctrl shift KP_UP", "selectPreviousExtendSelection",
1469                                "ctrl UP", "selectPreviousChangeLead",
1470                             "ctrl KP_UP", "selectPreviousChangeLead",
1471                           "DOWN", "selectNext",
1472                        "KP_DOWN", "selectNext",
1473                     "shift DOWN", "selectNextExtendSelection",
1474                  "shift KP_DOWN", "selectNextExtendSelection",
1475                        "ctrl shift DOWN", "selectNextExtendSelection",
1476                     "ctrl shift KP_DOWN", "selectNextExtendSelection",
1477                              "ctrl DOWN", "selectNextChangeLead",
1478                           "ctrl KP_DOWN", "selectNextChangeLead",
1479                          "RIGHT", "selectChild",
1480                       "KP_RIGHT", "selectChild",
1481                           "LEFT", "selectParent",
1482                        "KP_LEFT", "selectParent",
1483                        "PAGE_UP", "scrollUpChangeSelection",
1484                  "shift PAGE_UP", "scrollUpExtendSelection",
1485                     "ctrl shift PAGE_UP", "scrollUpExtendSelection",
1486                           "ctrl PAGE_UP", "scrollUpChangeLead",
1487                      "PAGE_DOWN", "scrollDownChangeSelection",
1488                "shift PAGE_DOWN", "scrollDownExtendSelection",
1489                   "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
1490                         "ctrl PAGE_DOWN", "scrollDownChangeLead",
1491                           "HOME", "selectFirst",
1492                     "shift HOME", "selectFirstExtendSelection",
1493                        "ctrl shift HOME", "selectFirstExtendSelection",
1494                              "ctrl HOME", "selectFirstChangeLead",
1495                            "END", "selectLast",
1496                      "shift END", "selectLastExtendSelection",
1497                         "ctrl shift END", "selectLastExtendSelection",
1498                               "ctrl END", "selectLastChangeLead",
1499                             "F2", "startEditing",
1500                         "ctrl A", "selectAll",
1501                     "ctrl SLASH", "selectAll",
1502                "ctrl BACK_SLASH", "clearSelection",
1503                      "ctrl LEFT", "scrollLeft",
1504                   "ctrl KP_LEFT", "scrollLeft",
1505                     "ctrl RIGHT", "scrollRight",
1506                  "ctrl KP_RIGHT", "scrollRight",
1507                                  "SPACE", "addToSelection",
1508                             "ctrl SPACE", "toggleAndAnchor",
1509                            "shift SPACE", "extendTo",
1510                       "ctrl shift SPACE", "moveSelectionTo"
1511         }),
1512        "Tree.ancestorInputMap",
1513           new UIDefaults.LazyInputMap(new Object JavaDoc[] {
1514             "ESCAPE", "cancel"
1515         }),
1516
1517        // *** Viewport
1518
"Viewport.font", ControlFont,
1519        "Viewport.background", ControlBackgroundColor,
1520        "Viewport.foreground", WindowTextColor,
1521
1522
1523        };
1524
1525        table.putDefaults(defaults);
1526    table.putDefaults(getLazyValueDefaults());
1527        initVistaComponentDefaults(table);
1528    }
1529    
1530    static boolean isOnVista() {
1531        boolean rv = false;
1532        String JavaDoc osName = System.getProperty("os.name");
1533        String JavaDoc osVers = System.getProperty("os.version");
1534        if (osName != null
1535                && osName.startsWith("Windows")
1536                && osVers != null
1537                && osVers.length() > 0) {
1538
1539            int p = osVers.indexOf('.');
1540            if (p >= 0) {
1541                osVers = osVers.substring(0, p);
1542            }
1543
1544            try {
1545                rv = (Integer.parseInt(osVers) >= 6);
1546            } catch (NumberFormatException JavaDoc nfe) {
1547            }
1548        }
1549        return rv;
1550    }
1551    private void initVistaComponentDefaults(UIDefaults table) {
1552        if (! isOnVista()) {
1553            return;
1554        }
1555        /* START handling menus for Vista */
1556        String JavaDoc[] menuClasses = { "MenuItem", "Menu",
1557                "CheckBoxMenuItem", "RadioButtonMenuItem",
1558        };
1559
1560        Object JavaDoc menuDefaults[] = new Object JavaDoc[menuClasses.length * 2];
1561
1562        /* all the menus need to be non opaque. */
1563        for (int i = 0, j = 0; i < menuClasses.length; i++) {
1564            String JavaDoc key = menuClasses[i] + ".opaque";
1565            Object JavaDoc oldValue = table.get(key);
1566            menuDefaults[j++] = key;
1567            menuDefaults[j++] =
1568                new XPValue(Boolean.FALSE, oldValue);
1569        }
1570        table.putDefaults(menuDefaults);
1571
1572        /*
1573         * acceleratorSelectionForeground color is the same as
1574         * acceleratorForeground
1575         */

1576        for (int i = 0, j = 0; i < menuClasses.length; i++) {
1577            String JavaDoc key = menuClasses[i] + ".acceleratorSelectionForeground";
1578            Object JavaDoc oldValue = table.get(key);
1579            menuDefaults[j++] = key;
1580            menuDefaults[j++] =
1581                new XPValue(
1582                    table.getColor(
1583                        menuClasses[i] + ".acceleratorForeground"),
1584                        oldValue);
1585        }
1586        table.putDefaults(menuDefaults);
1587
1588        /* they have the same MenuItemCheckIconFactory */
1589        VistaMenuItemCheckIconFactory menuItemCheckIconFactory =
1590            WindowsIconFactory.getMenuItemCheckIconFactory();
1591        for (int i = 0, j = 0; i < menuClasses.length; i++) {
1592            String JavaDoc key = menuClasses[i] + ".checkIconFactory";
1593            Object JavaDoc oldValue = table.get(key);
1594            menuDefaults[j++] = key;
1595            menuDefaults[j++] =
1596                new XPValue(menuItemCheckIconFactory, oldValue);
1597        }
1598        table.putDefaults(menuDefaults);
1599        
1600        for (int i = 0, j = 0; i < menuClasses.length; i++) {
1601            String JavaDoc key = menuClasses[i] + ".checkIcon";
1602            Object JavaDoc oldValue = table.get(key);
1603            menuDefaults[j++] = key;
1604            menuDefaults[j++] =
1605                new XPValue(menuItemCheckIconFactory.getIcon(menuClasses[i]),
1606                    oldValue);
1607        }
1608        table.putDefaults(menuDefaults);
1609        
1610
1611        /* height can be even */
1612        for (int i = 0, j = 0; i < menuClasses.length; i++) {
1613            String JavaDoc key = menuClasses[i] + ".evenHeight";
1614            Object JavaDoc oldValue = table.get(key);
1615            menuDefaults[j++] = key;
1616            menuDefaults[j++] = new XPValue(Boolean.TRUE, oldValue);
1617        }
1618        table.putDefaults(menuDefaults);
1619
1620        /* no margins */
1621        InsetsUIResource insets = new InsetsUIResource(0, 0, 0, 0);
1622        for (int i = 0, j = 0; i < menuClasses.length; i++) {
1623            String JavaDoc key = menuClasses[i] + ".margin";
1624            Object JavaDoc oldValue = table.get(key);
1625            menuDefaults[j++] = key;
1626            menuDefaults[j++] = new XPValue(insets, oldValue);
1627        }
1628        table.putDefaults(menuDefaults);
1629
1630        /* set checkIcon offset */
1631        Integer JavaDoc checkIconOffsetInteger =
1632            Integer.valueOf(0);
1633        for (int i = 0, j = 0; i < menuClasses.length; i++) {
1634            String JavaDoc key = menuClasses[i] + ".checkIconOffset";
1635            Object JavaDoc oldValue = table.get(key);
1636            menuDefaults[j++] = key;
1637            menuDefaults[j++] =
1638                new XPValue(checkIconOffsetInteger, oldValue);
1639        }
1640        table.putDefaults(menuDefaults);
1641
1642        /* text is started after this position */
1643        Object JavaDoc minimumTextOffset = new UIDefaults.ActiveValue() {
1644            public Object JavaDoc createValue(UIDefaults table) {
1645                return VistaMenuItemCheckIconFactory.getIconWidth()
1646                + WindowsPopupMenuUI.getSpanBeforeGutter()
1647                + WindowsPopupMenuUI.getGutterWidth()
1648                + WindowsPopupMenuUI.getSpanAfterGutter();
1649            }
1650        };
1651        for (int i = 0, j = 0; i < menuClasses.length; i++) {
1652            String JavaDoc key = menuClasses[i] + ".minimumTextOffset";
1653            Object JavaDoc oldValue = table.get(key);
1654            menuDefaults[j++] = key;
1655            menuDefaults[j++] = new XPValue(minimumTextOffset, oldValue);
1656        }
1657        table.putDefaults(menuDefaults);
1658
1659        /*
1660         * JPopupMenu has a bit of free space around menu items
1661         */

1662        String JavaDoc POPUP_MENU_BORDER = "PopupMenu.border";
1663        
1664        Object JavaDoc popupMenuBorder = new XPBorderValue(Part.MENU,
1665                new SwingLazyValue(
1666                  "javax.swing.plaf.basic.BasicBorders",
1667                  "getInternalFrameBorder"),
1668                  BorderFactory.createEmptyBorder(2, 2, 2, 2));
1669        table.put(POPUP_MENU_BORDER, popupMenuBorder);
1670        /* END handling menus for Vista */
1671    }
1672    
1673    /**
1674     * If we support loading of fonts from the desktop this will return
1675     * a DesktopProperty representing the font. If the font can't be
1676     * represented in the current encoding this will return null and
1677     * turn off the use of system fonts.
1678     */

1679    private Object JavaDoc getDesktopFontValue(String JavaDoc fontName, Object JavaDoc backup,
1680                                       Toolkit kit) {
1681        if (useSystemFontSettings) {
1682            return new WindowsFontProperty(fontName, backup, kit);
1683        }
1684        return null;
1685    }
1686
1687    // When a desktop property change is detected, these classes must be
1688
// reinitialized in the defaults table to ensure the classes reference
1689
// the updated desktop property values (colors mostly)
1690
//
1691
private Object JavaDoc[] getLazyValueDefaults() {
1692
1693    Object JavaDoc buttonBorder =
1694            new XPBorderValue(Part.BP_PUSHBUTTON,
1695                  new SwingLazyValue(
1696                   "javax.swing.plaf.basic.BasicBorders",
1697                   "getButtonBorder"));
1698
1699    Object JavaDoc textFieldBorder =
1700            new XPBorderValue(Part.EP_EDIT,
1701                  new SwingLazyValue(
1702                   "javax.swing.plaf.basic.BasicBorders",
1703                   "getTextFieldBorder"));
1704
1705    Object JavaDoc textFieldMargin =
1706        new XPValue(new InsetsUIResource(1, 5, 2, 4),
1707            new InsetsUIResource(1, 1, 1, 1));
1708
1709    Object JavaDoc spinnerBorder = textFieldBorder;
1710
1711        Object JavaDoc comboBoxBorder =
1712            new XPBorderValue(Part.CP_COMBOBOX, textFieldBorder);
1713
1714    // For focus rectangle for cells and trees.
1715
Object JavaDoc focusCellHighlightBorder = new SwingLazyValue(
1716              "com.sun.java.swing.plaf.windows.WindowsBorders",
1717              "getFocusCellHighlightBorder");
1718
1719    Object JavaDoc etchedBorder = new SwingLazyValue(
1720              "javax.swing.plaf.BorderUIResource",
1721              "getEtchedBorderUIResource");
1722
1723    Object JavaDoc internalFrameBorder = new SwingLazyValue(
1724                "com.sun.java.swing.plaf.windows.WindowsBorders",
1725        "getInternalFrameBorder");
1726
1727        Object JavaDoc loweredBevelBorder = new SwingLazyValue(
1728              "javax.swing.plaf.BorderUIResource",
1729              "getLoweredBevelBorderUIResource");
1730
1731
1732        Object JavaDoc marginBorder = new SwingLazyValue(
1733                "javax.swing.plaf.basic.BasicBorders$MarginBorder");
1734
1735    Object JavaDoc menuBarBorder = new SwingLazyValue(
1736                "javax.swing.plaf.basic.BasicBorders",
1737        "getMenuBarBorder");
1738
1739
1740        Object JavaDoc popupMenuBorder = new XPBorderValue(Part.MENU,
1741            new SwingLazyValue(
1742              "javax.swing.plaf.basic.BasicBorders",
1743              "getInternalFrameBorder"));
1744
1745    // *** ProgressBar
1746
Object JavaDoc progressBarBorder = new SwingLazyValue(
1747                  "com.sun.java.swing.plaf.windows.WindowsBorders",
1748                  "getProgressBarBorder");
1749
1750    Object JavaDoc radioButtonBorder = new SwingLazyValue(
1751                   "javax.swing.plaf.basic.BasicBorders",
1752                   "getRadioButtonBorder");
1753
1754    Object JavaDoc scrollPaneBorder =
1755            new XPBorderValue(Part.LBP_LISTBOX, textFieldBorder);
1756
1757    Object JavaDoc tableScrollPaneBorder =
1758            new XPBorderValue(Part.LBP_LISTBOX, loweredBevelBorder);
1759
1760    Object JavaDoc tableHeaderBorder = new SwingLazyValue(
1761              "com.sun.java.swing.plaf.windows.WindowsBorders",
1762              "getTableHeaderBorder");
1763
1764    // *** ToolBar
1765
Object JavaDoc toolBarBorder = new SwingLazyValue(
1766                  "com.sun.java.swing.plaf.windows.WindowsBorders",
1767                  "getToolBarBorder");
1768
1769        // *** ToolTips
1770
Object JavaDoc toolTipBorder = new SwingLazyValue(
1771                              "javax.swing.plaf.BorderUIResource",
1772                  "getBlackLineBorderUIResource");
1773
1774
1775
1776        Object JavaDoc checkBoxIcon = new SwingLazyValue(
1777             "com.sun.java.swing.plaf.windows.WindowsIconFactory",
1778             "getCheckBoxIcon");
1779
1780        Object JavaDoc radioButtonIcon = new SwingLazyValue(
1781             "com.sun.java.swing.plaf.windows.WindowsIconFactory",
1782             "getRadioButtonIcon");
1783
1784        Object JavaDoc menuItemCheckIcon = new SwingLazyValue(
1785             "com.sun.java.swing.plaf.windows.WindowsIconFactory",
1786             "getMenuItemCheckIcon");
1787
1788        Object JavaDoc menuItemArrowIcon = new SwingLazyValue(
1789             "com.sun.java.swing.plaf.windows.WindowsIconFactory",
1790             "getMenuItemArrowIcon");
1791
1792        Object JavaDoc menuArrowIcon = new SwingLazyValue(
1793             "com.sun.java.swing.plaf.windows.WindowsIconFactory",
1794             "getMenuArrowIcon");
1795
1796
1797        Object JavaDoc[] lazyDefaults = {
1798        "Button.border", buttonBorder,
1799            "CheckBox.border", radioButtonBorder,
1800            "ComboBox.border", comboBoxBorder,
1801        "DesktopIcon.border", internalFrameBorder,
1802        "FormattedTextField.border", textFieldBorder,
1803        "FormattedTextField.margin", textFieldMargin,
1804        "InternalFrame.border", internalFrameBorder,
1805        "List.focusCellHighlightBorder", focusCellHighlightBorder,
1806        "Table.focusCellHighlightBorder", focusCellHighlightBorder,
1807        "Menu.border", marginBorder,
1808        "MenuBar.border", menuBarBorder,
1809            "MenuItem.border", marginBorder,
1810            "PasswordField.border", textFieldBorder,
1811            "PasswordField.margin", textFieldMargin,
1812        "PopupMenu.border", popupMenuBorder,
1813        "ProgressBar.border", progressBarBorder,
1814            "RadioButton.border", radioButtonBorder,
1815        "ScrollPane.border", scrollPaneBorder,
1816        "Spinner.border", spinnerBorder,
1817        "Table.scrollPaneBorder", tableScrollPaneBorder,
1818        "TableHeader.cellBorder", tableHeaderBorder,
1819        "TextField.border", textFieldBorder,
1820        "TextField.margin", textFieldMargin,
1821            "TitledBorder.border",
1822                        new XPBorderValue(Part.BP_GROUPBOX, etchedBorder),
1823            "ToggleButton.border", radioButtonBorder,
1824        "ToolBar.border", toolBarBorder,
1825            "ToolTip.border", toolTipBorder,
1826
1827            "CheckBox.icon", checkBoxIcon,
1828            "Menu.arrowIcon", menuArrowIcon,
1829            "MenuItem.checkIcon", menuItemCheckIcon,
1830            "MenuItem.arrowIcon", menuItemArrowIcon,
1831            "RadioButton.icon", radioButtonIcon,
1832            "InternalFrame.layoutTitlePaneAtOrigin",
1833            new XPValue(Boolean.TRUE, Boolean.FALSE),
1834
1835    };
1836
1837    return lazyDefaults;
1838    }
1839
1840    public void uninitialize() {
1841        super.uninitialize();
1842    toolkit = null;
1843
1844        if (WindowsPopupMenuUI.mnemonicListener != null) {
1845            MenuSelectionManager.defaultManager().
1846                removeChangeListener(WindowsPopupMenuUI.mnemonicListener);
1847        }
1848        KeyboardFocusManager.getCurrentKeyboardFocusManager().
1849            removeKeyEventPostProcessor(WindowsRootPaneUI.altProcessor);
1850        DesktopProperty.flushUnreferencedProperties();
1851    }
1852
1853
1854    // Toggle flag for drawing the mnemonic state
1855
private static boolean isMnemonicHidden = true;
1856
1857    // Flag which indicates that the Win98/Win2k/WinME features
1858
// should be disabled.
1859
private static boolean isClassicWindows = false;
1860
1861    /**
1862     * Sets the state of the hide mnemonic flag. This flag is used by the
1863     * component UI delegates to determine if the mnemonic should be rendered.
1864     * This method is a non operation if the underlying operating system
1865     * does not support the mnemonic hiding feature.
1866     *
1867     * @param hide true if mnemonics should be hidden
1868     * @since 1.4
1869     */

1870    public static void setMnemonicHidden(boolean hide) {
1871    if (UIManager.getBoolean("Button.showMnemonics") == true) {
1872        // Do not hide mnemonics if the UI defaults do not support this
1873
isMnemonicHidden = false;
1874    } else {
1875        isMnemonicHidden = hide;
1876    }
1877    }
1878
1879    /**
1880     * Gets the state of the hide mnemonic flag. This only has meaning
1881     * if this feature is supported by the underlying OS.
1882     *
1883     * @return true if mnemonics are hidden, otherwise, false
1884     * @see #setMnemonicHidden
1885     * @since 1.4
1886     */

1887    public static boolean isMnemonicHidden() {
1888    if (UIManager.getBoolean("Button.showMnemonics") == true) {
1889        // Do not hide mnemonics if the UI defaults do not support this
1890
isMnemonicHidden = false;
1891    }
1892    return isMnemonicHidden;
1893    }
1894
1895    /**
1896     * Gets the state of the flag which indicates if the old Windows
1897     * look and feel should be rendered. This flag is used by the
1898     * component UI delegates as a hint to determine which style the component
1899     * should be rendered.
1900     *
1901     * @return true if Windows 95 and Windows NT 4 look and feel should
1902     * be rendered
1903     * @since 1.4
1904     */

1905    public static boolean isClassicWindows() {
1906    return isClassicWindows;
1907    }
1908
1909    /**
1910     * <p>
1911     * Invoked when the user attempts an invalid operation,
1912     * such as pasting into an uneditable <code>JTextField</code>
1913     * that has focus.
1914     * </p>
1915     * <p>
1916     * If the user has enabled visual error indication on
1917     * the desktop, this method will flash the caption bar
1918     * of the active window. The user can also set the
1919     * property awt.visualbell=true to achieve the same
1920     * results.
1921     * </p>
1922     *
1923     * @param component Component the error occured in, may be
1924     * null indicating the error condition is
1925     * not directly associated with a
1926     * <code>Component</code>.
1927     *
1928     * @see javax.swing.LookAndFeel#provideErrorFeedback
1929     */

1930     public void provideErrorFeedback(Component JavaDoc component) {
1931     super.provideErrorFeedback(component);
1932     }
1933
1934    // ********* Auditory Cue support methods and objects *********
1935

1936    /**
1937     * Returns an <code>Action</code>.
1938     * <P>
1939     * This Action contains the information and logic to render an
1940     * auditory cue. The <code>Object</code> that is passed to this
1941     * method contains the information needed to render the auditory
1942     * cue. Normally, this <code>Object</code> is a <code>String</code>
1943     * that points to a <code>Toolkit</code> <code>desktopProperty</code>.
1944     * This <code>desktopProperty</code> is resolved by AWT and the
1945     * Windows OS.
1946     * <P>
1947     * This <code>Action</code>'s <code>actionPerformed</code> method
1948     * is fired by the <code>playSound</code> method.
1949     *
1950     * @return an Action which knows how to render the auditory
1951     * cue for one particular system or user activity
1952     * @see #playSound(Action)
1953     * @since 1.4
1954     */

1955    protected Action createAudioAction(Object JavaDoc key) {
1956    if (key != null) {
1957        String JavaDoc audioKey = (String JavaDoc)key;
1958        String JavaDoc audioValue = (String JavaDoc)UIManager.get(key);
1959        return new AudioAction(audioKey, audioValue);
1960        } else {
1961        return null;
1962    }
1963    }
1964
1965    static void repaintRootPane(Component JavaDoc c) {
1966        JRootPane root = null;
1967        for (; c != null; c = c.getParent()) {
1968            if (c instanceof JRootPane) {
1969                root = (JRootPane)c;
1970            }
1971        }
1972
1973        if (root != null) {
1974            root.repaint();
1975        } else {
1976            c.repaint();
1977        }
1978    }
1979
1980    /**
1981     * Pass the name String to the super constructor. This is used
1982     * later to identify the Action and decide whether to play it or
1983     * not. Store the resource String. It is used to get the audio
1984     * resource. In this case, the resource is a <code>Runnable</code>
1985     * supplied by <code>Toolkit</code>. This <code>Runnable</code> is
1986     * effectively a pointer down into the Win32 OS that knows how to
1987     * play the right sound.
1988     *
1989     * @since 1.4
1990     */

1991    private static class AudioAction extends AbstractAction {
1992    private Runnable JavaDoc audioRunnable;
1993    private String JavaDoc audioResource;
1994    /**
1995     * We use the String as the name of the Action and as a pointer to
1996     * the underlying OSes audio resource.
1997     */

1998    public AudioAction(String JavaDoc name, String JavaDoc resource) {
1999        super(name);
2000        audioResource = resource;
2001    }
2002    public void actionPerformed(ActionEvent JavaDoc e) {
2003        if (audioRunnable == null) {
2004        audioRunnable = (Runnable JavaDoc)Toolkit.getDefaultToolkit().getDesktopProperty(audioResource);
2005        }
2006        if (audioRunnable != null) {
2007                // Runnable appears to block until completed playing, hence
2008
// start up another thread to handle playing.
2009
new Thread JavaDoc(audioRunnable).start();
2010        }
2011    }
2012    }
2013
2014    /**
2015     * Gets an <code>Icon</code> from the native libraries if available,
2016     * otherwise gets it from an image resource file.
2017     */

2018    private static class LazyWindowsIcon implements UIDefaults.LazyValue {
2019    private String JavaDoc nativeImage;
2020    private String JavaDoc resource;
2021
2022    LazyWindowsIcon(String JavaDoc nativeImage, String JavaDoc resource) {
2023        this.nativeImage = nativeImage;
2024        this.resource = resource;
2025    }
2026
2027    public Object JavaDoc createValue(UIDefaults table) {
2028        if (nativeImage != null) {
2029        Image image = (Image)ShellFolder.get(nativeImage);
2030        if (image != null) {
2031            return new ImageIcon(image);
2032        }
2033        }
2034            return SwingUtilities2.makeIcon(getClass(),
2035                                            WindowsLookAndFeel.class,
2036                                            resource);
2037    }
2038    }
2039
2040
2041    /**
2042     * DesktopProperty for fonts. If a font with the name 'MS Sans Serif'
2043     * is returned, it is mapped to 'Microsoft Sans Serif'.
2044     */

2045    private static class WindowsFontProperty extends DesktopProperty {
2046        WindowsFontProperty(String JavaDoc key, Object JavaDoc backup, Toolkit kit) {
2047            super(key, backup, kit);
2048        }
2049
2050        protected Object JavaDoc configureValue(Object JavaDoc value) {
2051            if (value instanceof Font JavaDoc) {
2052                Font JavaDoc font = (Font JavaDoc)value;
2053                if ("MS Sans Serif".equals(font.getName())) {
2054            int size = font.getSize();
2055            // 4950968: Workaround to mimic the way Windows maps the default
2056
// font size of 6 pts to the smallest available bitmap font size.
2057
// This happens mostly on Win 98/Me & NT.
2058
int dpi;
2059            try {
2060            dpi = Toolkit.getDefaultToolkit().getScreenResolution();
2061            } catch (HeadlessException ex) {
2062            dpi = 96;
2063            }
2064            if (Math.round(size * 72F / dpi) < 8) {
2065            size = Math.round(8 * dpi / 72F);
2066            }
2067                    Font JavaDoc msFont = new FontUIResource("Microsoft Sans Serif",
2068                                          font.getStyle(), size);
2069                    if (msFont.getName() != null &&
2070                        msFont.getName().equals(msFont.getFamily())) {
2071                        font = msFont;
2072            } else if (size != font.getSize()) {
2073            font = new FontUIResource("MS Sans Serif",
2074                          font.getStyle(), size);
2075                    }
2076                }
2077                if (FontManager.fontSupportsDefaultEncoding(font)) {
2078                    if (!(font instanceof UIResource)) {
2079                        font = new FontUIResource(font);
2080                    }
2081                }
2082                else {
2083                    font = FontManager.getCompositeFontUIResource(font);
2084                }
2085                return font;
2086
2087            }
2088            return super.configureValue(value);
2089        }
2090    }
2091
2092
2093    /**
2094     * DesktopProperty for fonts that only gets sizes from the desktop,
2095     * font name and style are passed into the constructor
2096     */

2097    private static class WindowsFontSizeProperty extends DesktopProperty {
2098        private String JavaDoc fontName;
2099        private int fontSize;
2100        private int fontStyle;
2101
2102        WindowsFontSizeProperty(String JavaDoc key, Toolkit toolkit, String JavaDoc fontName,
2103                                int fontStyle, int fontSize) {
2104            super(key, null, toolkit);
2105            this.fontName = fontName;
2106            this.fontSize = fontSize;
2107            this.fontStyle = fontStyle;
2108        }
2109
2110        protected Object JavaDoc configureValue(Object JavaDoc value) {
2111            if (value == null) {
2112                value = new FontUIResource(fontName, fontStyle, fontSize);
2113            }
2114            else if (value instanceof Integer JavaDoc) {
2115                value = new FontUIResource(fontName, fontStyle,
2116                                           ((Integer JavaDoc)value).intValue());
2117            }
2118            return value;
2119        }
2120    }
2121
2122
2123    /**
2124     * A value wrapper that actively retrieves values from xp or falls back
2125     * to the classic value if not running XP styles.
2126     */

2127    private static class XPValue implements UIDefaults.ActiveValue {
2128    protected Object JavaDoc classicValue, xpValue;
2129
2130    XPValue(Object JavaDoc xpValue, Object JavaDoc classicValue) {
2131        this.xpValue = xpValue;
2132        this.classicValue = classicValue;
2133    }
2134
2135    public Object JavaDoc createValue(UIDefaults table) {
2136        Object JavaDoc value = null;
2137        if (XPStyle.getXP() != null) {
2138        value = getXPValue(table);
2139        }
2140        return (value != null) ? value : getClassicValue(table);
2141    }
2142
2143    protected Object JavaDoc getXPValue(UIDefaults table) {
2144        return recursiveCreateValue(xpValue, table);
2145    }
2146
2147    protected Object JavaDoc getClassicValue(UIDefaults table) {
2148        return recursiveCreateValue(classicValue, table);
2149    }
2150
2151    private Object JavaDoc recursiveCreateValue(Object JavaDoc value, UIDefaults table) {
2152        if (value instanceof UIDefaults.LazyValue) {
2153        value = ((UIDefaults.LazyValue)value).createValue(table);
2154        }
2155        if (value instanceof UIDefaults.ActiveValue) {
2156        return ((UIDefaults.ActiveValue)value).createValue(table);
2157        } else {
2158        return value;
2159        }
2160    }
2161    }
2162
2163    private static class XPBorderValue extends XPValue {
2164        private final Border extraMargin;
2165        
2166        XPBorderValue(Part xpValue, Object JavaDoc classicValue) {
2167            this(xpValue, classicValue, null);
2168    }
2169
2170        XPBorderValue(Part xpValue, Object JavaDoc classicValue, Border extraMargin) {
2171            super(xpValue, classicValue);
2172            this.extraMargin = extraMargin;
2173        }
2174
2175    public Object JavaDoc getXPValue(UIDefaults table) {
2176            Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue);
2177            if (extraMargin != null) {
2178                return new BorderUIResource.
2179                        CompoundBorderUIResource(xpBorder, extraMargin);
2180            } else {
2181                return xpBorder;
2182            }
2183    }
2184    }
2185
2186    private static class XPColorValue extends XPValue {
2187        XPColorValue(Part part, State state, Prop prop, Object JavaDoc classicValue) {
2188            super(new XPColorValueKey(part, state, prop), classicValue);
2189    }
2190
2191    public Object JavaDoc getXPValue(UIDefaults table) {
2192            XPColorValueKey key = (XPColorValueKey)xpValue;
2193            return XPStyle.getXP().getColor(key.skin, key.prop, null);
2194        }
2195        
2196        private static class XPColorValueKey {
2197            Skin skin;
2198            Prop prop;
2199 
2200            XPColorValueKey(Part part, State state, Prop prop) {
2201                this.skin = new Skin(part, state);
2202                this.prop = prop;
2203            }
2204    }
2205    }
2206
2207    private class TriggerDesktopProperty extends DesktopProperty {
2208    TriggerDesktopProperty(String JavaDoc key) {
2209        super(key, null, toolkit);
2210        // This call adds a property change listener for the property,
2211
// which triggers a call to updateUI(). The value returned
2212
// is not interesting here.
2213
getValueFromDesktop();
2214    }
2215
2216    protected void updateUI() {
2217        super.updateUI();
2218
2219        // Make sure property change listener is readded each time
2220
getValueFromDesktop();
2221    }
2222    }
2223}
2224
Popular Tags