KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > basic > BasicLookAndFeel


1 /*
2  * @(#)BasicLookAndFeel.java 1.242 06/08/16
3  *
4  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing.plaf.basic;
9
10 import java.awt.Font JavaDoc;
11 import java.awt.Color JavaDoc;
12 import java.awt.SystemColor JavaDoc;
13 import java.awt.event.*;
14 import java.awt.Insets JavaDoc;
15 import java.awt.Component JavaDoc;
16 import java.awt.Container JavaDoc;
17 import java.awt.FocusTraversalPolicy JavaDoc;
18 import java.awt.AWTEvent JavaDoc;
19 import java.awt.Toolkit JavaDoc;
20 import java.awt.Point JavaDoc;
21 import java.net.URL JavaDoc;
22 import java.io.*;
23 import java.awt.Dimension JavaDoc;
24 import java.awt.KeyboardFocusManager JavaDoc;
25 import java.security.AccessController JavaDoc;
26 import java.security.PrivilegedAction JavaDoc;
27 import java.util.*;
28 import java.lang.reflect.*;
29 import javax.sound.sampled.*;
30
31 import sun.awt.AppContext;
32
33 import sun.swing.SwingLazyValue;
34 import com.sun.java.swing.SwingUtilities2;
35
36 import javax.swing.LookAndFeel JavaDoc;
37 import javax.swing.AbstractAction JavaDoc;
38 import javax.swing.Action JavaDoc;
39 import javax.swing.ActionMap JavaDoc;
40 import javax.swing.BorderFactory JavaDoc;
41 import javax.swing.JComponent JavaDoc;
42 import javax.swing.ImageIcon JavaDoc;
43 import javax.swing.UIDefaults JavaDoc;
44 import javax.swing.UIManager JavaDoc;
45 import javax.swing.KeyStroke JavaDoc;
46 import javax.swing.JTextField JavaDoc;
47 import javax.swing.DefaultListCellRenderer JavaDoc;
48 import javax.swing.FocusManager JavaDoc;
49 import javax.swing.LayoutFocusTraversalPolicy JavaDoc;
50 import javax.swing.SwingUtilities JavaDoc;
51 import javax.swing.MenuSelectionManager JavaDoc;
52 import javax.swing.MenuElement JavaDoc;
53 import javax.swing.border.*;
54 import javax.swing.plaf.*;
55 import javax.swing.text.JTextComponent JavaDoc;
56 import javax.swing.text.DefaultEditorKit JavaDoc;
57 import java.beans.PropertyChangeListener JavaDoc;
58 import java.beans.PropertyChangeEvent JavaDoc;
59
60
61 /**
62  * Implements the a standard base LookAndFeel class from which
63  * standard desktop LookAndFeel classes (JLF, Mac, Windows, etc.)
64  * can be derived. This class cannot be instantiated directly,
65  * however the UI classes "Basic" defines can be.
66  * <p>
67  * <strong>Warning:</strong>
68  * Serialized objects of this class will not be compatible with
69  * future Swing releases. The current serialization support is
70  * appropriate for short term storage or RMI between applications running
71  * the same version of Swing. As of 1.4, support for long term storage
72  * of all JavaBeans<sup><font size="-2">TM</font></sup>
73  * has been added to the <code>java.beans</code> package.
74  * Please see {@link java.beans.XMLEncoder}.
75  *
76  * @version 1.242 08/16/06
77  * @author unattributed
78  */

79 public abstract class BasicLookAndFeel extends LookAndFeel JavaDoc implements Serializable
80 {
81     /**
82      * Whether or not the developer has created a JPopupMenu.
83      */

84     static boolean hasPopups;
85
86     /**
87      * Lock used when manipulating clipPlaying.
88      */

89     private Object JavaDoc audioLock = new Object JavaDoc();
90     /**
91      * The Clip that is currently playing (set in AudioAction).
92      */

93     private Clip clipPlaying;
94
95     PopupInvocationHelper invocator = null;
96
97     /*
98      * Listen for our AppContext being disposed
99      */

100     private PropertyChangeListener JavaDoc disposer = null;
101
102     public UIDefaults JavaDoc getDefaults() {
103     UIDefaults JavaDoc table = new UIDefaults JavaDoc();
104
105     initClassDefaults(table);
106     initSystemColorDefaults(table);
107     initComponentDefaults(table);
108
109     return table;
110     }
111
112     /**
113      * UIManager.setLookAndFeel calls this method before the first call
114      * (and typically the only call) to getDefaults().
115      */

116     public void initialize() {
117         if (hasPopups) {
118             createdPopup();
119         }
120     }
121
122     /**
123      * UIManager.setLookAndFeel calls this method just
124      * before we're replaced by a new default look and feel.
125      */

126     public void uninitialize() {
127         Toolkit JavaDoc tk = Toolkit.getDefaultToolkit();
128         if(invocator != null) {
129             AccessController.doPrivileged(invocator);
130             invocator = null;
131         }
132
133         if (disposer != null) {
134             // Note that we're likely calling removePropertyChangeListener()
135
// during the course of AppContext.firePropertyChange().
136
// However, EventListenerAggreggate has code to safely modify
137
// the list under such circumstances.
138
AppContext.getAppContext().removePropertyChangeListener(
139                                                         AppContext.GUI_DISPOSED,
140                                                         disposer);
141             disposer = null;
142         }
143     }
144
145     /**
146      * Initialize the uiClassID to BasicComponentUI mapping.
147      * The JComponent classes define their own uiClassID constants
148      * (see AbstractComponent.getUIClassID). This table must
149      * map those constants to a BasicComponentUI class of the
150      * appropriate type.
151      *
152      * @see #getDefaults
153      */

154     protected void initClassDefaults(UIDefaults JavaDoc table)
155     {
156     final String JavaDoc basicPackageName = "javax.swing.plaf.basic.";
157     Object JavaDoc[] uiDefaults = {
158            "ButtonUI", basicPackageName + "BasicButtonUI",
159          "CheckBoxUI", basicPackageName + "BasicCheckBoxUI",
160              "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
161        "FormattedTextFieldUI", basicPackageName + "BasicFormattedTextFieldUI",
162           "MenuBarUI", basicPackageName + "BasicMenuBarUI",
163              "MenuUI", basicPackageName + "BasicMenuUI",
164          "MenuItemUI", basicPackageName + "BasicMenuItemUI",
165      "CheckBoxMenuItemUI", basicPackageName + "BasicCheckBoxMenuItemUI",
166       "RadioButtonMenuItemUI", basicPackageName + "BasicRadioButtonMenuItemUI",
167           "RadioButtonUI", basicPackageName + "BasicRadioButtonUI",
168          "ToggleButtonUI", basicPackageName + "BasicToggleButtonUI",
169         "PopupMenuUI", basicPackageName + "BasicPopupMenuUI",
170           "ProgressBarUI", basicPackageName + "BasicProgressBarUI",
171         "ScrollBarUI", basicPackageName + "BasicScrollBarUI",
172            "ScrollPaneUI", basicPackageName + "BasicScrollPaneUI",
173         "SplitPaneUI", basicPackageName + "BasicSplitPaneUI",
174            "SliderUI", basicPackageName + "BasicSliderUI",
175         "SeparatorUI", basicPackageName + "BasicSeparatorUI",
176           "SpinnerUI", basicPackageName + "BasicSpinnerUI",
177      "ToolBarSeparatorUI", basicPackageName + "BasicToolBarSeparatorUI",
178        "PopupMenuSeparatorUI", basicPackageName + "BasicPopupMenuSeparatorUI",
179            "TabbedPaneUI", basicPackageName + "BasicTabbedPaneUI",
180          "TextAreaUI", basicPackageName + "BasicTextAreaUI",
181         "TextFieldUI", basicPackageName + "BasicTextFieldUI",
182         "PasswordFieldUI", basicPackageName + "BasicPasswordFieldUI",
183          "TextPaneUI", basicPackageName + "BasicTextPaneUI",
184                "EditorPaneUI", basicPackageName + "BasicEditorPaneUI",
185              "TreeUI", basicPackageName + "BasicTreeUI",
186             "LabelUI", basicPackageName + "BasicLabelUI",
187              "ListUI", basicPackageName + "BasicListUI",
188           "ToolBarUI", basicPackageName + "BasicToolBarUI",
189           "ToolTipUI", basicPackageName + "BasicToolTipUI",
190          "ComboBoxUI", basicPackageName + "BasicComboBoxUI",
191             "TableUI", basicPackageName + "BasicTableUI",
192           "TableHeaderUI", basicPackageName + "BasicTableHeaderUI",
193         "InternalFrameUI", basicPackageName + "BasicInternalFrameUI",
194           "DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI",
195           "DesktopIconUI", basicPackageName + "BasicDesktopIconUI",
196            "OptionPaneUI", basicPackageName + "BasicOptionPaneUI",
197                 "PanelUI", basicPackageName + "BasicPanelUI",
198          "ViewportUI", basicPackageName + "BasicViewportUI",
199          "RootPaneUI", basicPackageName + "BasicRootPaneUI",
200     };
201
202     table.putDefaults(uiDefaults);
203     }
204
205     /**
206      * Load the SystemColors into the defaults table. The keys
207      * for SystemColor defaults are the same as the names of
208      * the public fields in SystemColor. If the table is being
209      * created on a native Windows platform we use the SystemColor
210      * values, otherwise we create color objects whose values match
211      * the defaults Windows95 colors.
212      */

213     protected void initSystemColorDefaults(UIDefaults JavaDoc table)
214     {
215     String JavaDoc[] defaultSystemColors = {
216             "desktop", "#005C5C", /* Color of the desktop background */
217       "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
218       "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
219     "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
220         "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
221     "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
222   "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
223              "window", "#FFFFFF", /* Default color for the interior of windows */
224        "windowBorder", "#000000", /* ??? */
225          "windowText", "#000000", /* ??? */
226            "menu", "#C0C0C0", /* Background color for menus */
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", /* Specular highlight (opposite of the shadow) */
236      "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
237       "controlShadow", "#808080", /* Shadow color for controls */
238         "controlDkShadow", "#000000", /* Dark shadow color for controls */
239           "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
240            "info", "#FFFFE1", /* ??? */
241            "infoText", "#000000" /* ??? */
242     };
243
244     loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());
245     }
246
247
248     /**
249      * If this is the native look and feel the initial values for the
250      * system color properties are the same as the SystemColor constants.
251      * If not we use the integer color values in the <code>systemColors</code>
252      * argument.
253      */

254     protected void loadSystemColors(UIDefaults JavaDoc table, String JavaDoc[] systemColors, boolean useNative)
255     {
256     /* PENDING(hmuller) We don't load the system colors below because
257      * they're not reliable. Hopefully we'll be able to do better in
258      * a future version of AWT.
259      */

260     if (useNative) {
261         for(int i = 0; i < systemColors.length; i += 2) {
262         Color JavaDoc color = Color.black;
263         try {
264             String JavaDoc name = systemColors[i];
265             color = (Color JavaDoc)(SystemColor JavaDoc.class.getField(name).get(null));
266         } catch (Exception JavaDoc e) {
267         }
268         table.put(systemColors[i], new ColorUIResource(color));
269         }
270     } else {
271         for(int i = 0; i < systemColors.length; i += 2) {
272         Color JavaDoc color = Color.black;
273         try {
274             color = Color.decode(systemColors[i + 1]);
275         }
276         catch(NumberFormatException JavaDoc e) {
277             e.printStackTrace();
278         }
279         table.put(systemColors[i], new ColorUIResource(color));
280         }
281     }
282     }
283     /**
284      * Initialize the defaults table with the name of the ResourceBundle
285      * used for getting localized defaults. Also initialize the default
286      * locale used when no locale is passed into UIDefaults.get(). The
287      * default locale should generally not be relied upon. It is here for
288      * compatability with releases prior to 1.4.
289      */

290     private void initResourceBundle(UIDefaults JavaDoc table) {
291         table.setDefaultLocale( Locale.getDefault() );
292         table.addResourceBundle( "com.sun.swing.internal.plaf.basic.resources.basic" );
293     }
294
295     protected void initComponentDefaults(UIDefaults JavaDoc table)
296     {
297
298         initResourceBundle(table);
299
300     // *** Shared Integers
301
Integer JavaDoc fiveHundred = new Integer JavaDoc(500);
302
303     // *** Shared Longs
304
Long JavaDoc oneThousand = new Long JavaDoc(1000);
305
306     // *** Shared Fonts
307
Integer JavaDoc twelve = new Integer JavaDoc(12);
308     Integer JavaDoc fontPlain = new Integer JavaDoc(Font.PLAIN);
309     Integer JavaDoc fontBold = new Integer JavaDoc(Font.BOLD);
310     Object JavaDoc dialogPlain12 = new SwingLazyValue(
311               "javax.swing.plaf.FontUIResource",
312               null,
313               new Object JavaDoc[] {"Dialog", fontPlain, twelve});
314     Object JavaDoc serifPlain12 = new SwingLazyValue(
315               "javax.swing.plaf.FontUIResource",
316               null,
317               new Object JavaDoc[] {"Serif", fontPlain, twelve});
318     Object JavaDoc sansSerifPlain12 = new SwingLazyValue(
319               "javax.swing.plaf.FontUIResource",
320               null,
321               new Object JavaDoc[] {"SansSerif", fontPlain, twelve});
322     Object JavaDoc monospacedPlain12 = new SwingLazyValue(
323               "javax.swing.plaf.FontUIResource",
324               null,
325               new Object JavaDoc[] {"MonoSpaced", fontPlain, twelve});
326     Object JavaDoc dialogBold12 = new SwingLazyValue(
327               "javax.swing.plaf.FontUIResource",
328               null,
329               new Object JavaDoc[] {"Dialog", fontBold, twelve});
330
331
332     // *** Shared Colors
333
ColorUIResource red = new ColorUIResource(Color.red);
334     ColorUIResource black = new ColorUIResource(Color.black);
335         ColorUIResource white = new ColorUIResource(Color.white);
336     ColorUIResource yellow = new ColorUIResource(Color.yellow);
337         ColorUIResource gray = new ColorUIResource(Color.gray);
338     ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
339     ColorUIResource darkGray = new ColorUIResource(Color.darkGray);
340     ColorUIResource scrollBarTrack = new ColorUIResource(224, 224, 224);
341
342         Color JavaDoc control = table.getColor("control");
343         Color JavaDoc controlDkShadow = table.getColor("controlDkShadow");
344         Color JavaDoc controlHighlight = table.getColor("controlHighlight");
345         Color JavaDoc controlLtHighlight = table.getColor("controlLtHighlight");
346         Color JavaDoc controlShadow = table.getColor("controlShadow");
347         Color JavaDoc controlText = table.getColor("controlText");
348         Color JavaDoc menu = table.getColor("menu");
349         Color JavaDoc menuText = table.getColor("menuText");
350         Color JavaDoc textHighlight = table.getColor("textHighlight");
351         Color JavaDoc textHighlightText = table.getColor("textHighlightText");
352         Color JavaDoc textInactiveText = table.getColor("textInactiveText");
353         Color JavaDoc textText = table.getColor("textText");
354         Color JavaDoc window = table.getColor("window");
355
356         // *** Shared Insets
357
InsetsUIResource zeroInsets = new InsetsUIResource(0,0,0,0);
358         InsetsUIResource twoInsets = new InsetsUIResource(2, 2, 2, 2);
359
360         // *** Shared Borders
361
Object JavaDoc marginBorder = new SwingLazyValue(
362               "javax.swing.plaf.basic.BasicBorders$MarginBorder");
363     Object JavaDoc etchedBorder = new SwingLazyValue(
364               "javax.swing.plaf.BorderUIResource",
365               "getEtchedBorderUIResource");
366         Object JavaDoc loweredBevelBorder = new SwingLazyValue(
367               "javax.swing.plaf.BorderUIResource",
368               "getLoweredBevelBorderUIResource");
369     
370     Object JavaDoc popupMenuBorder = new SwingLazyValue(
371               "javax.swing.plaf.basic.BasicBorders",
372               "getInternalFrameBorder");
373
374         Object JavaDoc blackLineBorder = new SwingLazyValue(
375               "javax.swing.plaf.BorderUIResource",
376               "getBlackLineBorderUIResource");
377     Object JavaDoc focusCellHighlightBorder = new SwingLazyValue(
378               "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
379               null,
380               new Object JavaDoc[] {yellow});
381
382
383     Object JavaDoc tableHeaderBorder = new SwingLazyValue(
384               "javax.swing.plaf.BorderUIResource$BevelBorderUIResource",
385               null,
386               new Object JavaDoc[] { new Integer JavaDoc(BevelBorder.RAISED),
387                      controlLtHighlight,
388                                          control,
389                      controlDkShadow,
390                      controlShadow });
391
392
393     // *** Button value objects
394

395     Object JavaDoc buttonBorder =
396         new SwingLazyValue(
397                 "javax.swing.plaf.basic.BasicBorders",
398                 "getButtonBorder");
399
400     Object JavaDoc buttonToggleBorder =
401         new SwingLazyValue(
402                 "javax.swing.plaf.basic.BasicBorders",
403                 "getToggleButtonBorder");
404
405     Object JavaDoc radioButtonBorder =
406         new SwingLazyValue(
407                 "javax.swing.plaf.basic.BasicBorders",
408                 "getRadioButtonBorder");
409
410     // *** FileChooser / FileView value objects
411

412         Object JavaDoc newFolderIcon = SwingUtilities2.makeIcon(getClass(),
413                                                         BasicLookAndFeel JavaDoc.class,
414                                                         "icons/NewFolder.gif");
415         Object JavaDoc upFolderIcon = SwingUtilities2.makeIcon(getClass(),
416                                                        BasicLookAndFeel JavaDoc.class,
417                                                        "icons/UpFolder.gif");
418         Object JavaDoc homeFolderIcon = SwingUtilities2.makeIcon(getClass(),
419                                                          BasicLookAndFeel JavaDoc.class,
420                                                          "icons/HomeFolder.gif");
421         Object JavaDoc detailsViewIcon = SwingUtilities2.makeIcon(getClass(),
422                                                           BasicLookAndFeel JavaDoc.class,
423                                                           "icons/DetailsView.gif");
424         Object JavaDoc listViewIcon = SwingUtilities2.makeIcon(getClass(),
425                                                        BasicLookAndFeel JavaDoc.class,
426                                                        "icons/ListView.gif");
427         Object JavaDoc directoryIcon = SwingUtilities2.makeIcon(getClass(),
428                                                         BasicLookAndFeel JavaDoc.class,
429                                                         "icons/Directory.gif");
430         Object JavaDoc fileIcon = SwingUtilities2.makeIcon(getClass(),
431                                                    BasicLookAndFeel JavaDoc.class,
432                                                    "icons/File.gif");
433         Object JavaDoc computerIcon = SwingUtilities2.makeIcon(getClass(),
434                                                        BasicLookAndFeel JavaDoc.class,
435                                                        "icons/Computer.gif");
436         Object JavaDoc hardDriveIcon = SwingUtilities2.makeIcon(getClass(),
437                                                         BasicLookAndFeel JavaDoc.class,
438                                                         "icons/HardDrive.gif");
439         Object JavaDoc floppyDriveIcon = SwingUtilities2.makeIcon(getClass(),
440                                                           BasicLookAndFeel JavaDoc.class,
441                                                           "icons/FloppyDrive.gif");
442
443
444     // *** InternalFrame value objects
445

446     Object JavaDoc internalFrameBorder = new SwingLazyValue(
447                 "javax.swing.plaf.basic.BasicBorders",
448         "getInternalFrameBorder");
449
450     // *** List value objects
451

452     Object JavaDoc listCellRendererActiveValue = new UIDefaults.ActiveValue JavaDoc() {
453         public Object JavaDoc createValue(UIDefaults JavaDoc table) {
454         return new DefaultListCellRenderer.UIResource JavaDoc();
455         }
456     };
457
458
459     // *** Menus value objects
460

461     Object JavaDoc menuBarBorder =
462         new SwingLazyValue(
463                 "javax.swing.plaf.basic.BasicBorders",
464         "getMenuBarBorder");
465
466     Object JavaDoc menuItemCheckIcon =
467         new SwingLazyValue(
468         "javax.swing.plaf.basic.BasicIconFactory",
469         "getMenuItemCheckIcon");
470
471     Object JavaDoc menuItemArrowIcon =
472         new SwingLazyValue(
473         "javax.swing.plaf.basic.BasicIconFactory",
474         "getMenuItemArrowIcon");
475
476
477     Object JavaDoc menuArrowIcon =
478         new SwingLazyValue(
479         "javax.swing.plaf.basic.BasicIconFactory",
480         "getMenuArrowIcon");
481
482     Object JavaDoc checkBoxIcon =
483         new SwingLazyValue(
484         "javax.swing.plaf.basic.BasicIconFactory",
485         "getCheckBoxIcon");
486
487     Object JavaDoc radioButtonIcon =
488         new SwingLazyValue(
489         "javax.swing.plaf.basic.BasicIconFactory",
490         "getRadioButtonIcon");
491
492     Object JavaDoc checkBoxMenuItemIcon =
493         new SwingLazyValue(
494         "javax.swing.plaf.basic.BasicIconFactory",
495         "getCheckBoxMenuItemIcon");
496
497     Object JavaDoc radioButtonMenuItemIcon =
498         new SwingLazyValue(
499         "javax.swing.plaf.basic.BasicIconFactory",
500         "getRadioButtonMenuItemIcon");
501
502     Object JavaDoc menuItemAcceleratorDelimiter = new String JavaDoc("+");
503
504     // *** OptionPane value objects
505

506         Object JavaDoc optionPaneMinimumSize = new DimensionUIResource(262, 90);
507
508     Integer JavaDoc zero = new Integer JavaDoc(0);
509         Object JavaDoc zeroBorder = new SwingLazyValue(
510                "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
511                new Object JavaDoc[] {zero, zero, zero, zero});
512
513     Integer JavaDoc ten = new Integer JavaDoc(10);
514         Object JavaDoc optionPaneBorder = new SwingLazyValue(
515                "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
516                new Object JavaDoc[] {ten, ten, twelve, ten});
517     
518         Object JavaDoc optionPaneButtonAreaBorder = new SwingLazyValue(
519                "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
520                new Object JavaDoc[] {new Integer JavaDoc(6), zero, zero, zero});
521
522
523     // *** ProgessBar value objects
524

525     Object JavaDoc progressBarBorder =
526         new SwingLazyValue(
527                 "javax.swing.plaf.basic.BasicBorders",
528                 "getProgressBarBorder");
529
530     // ** ScrollBar value objects
531

532     Object JavaDoc minimumThumbSize = new DimensionUIResource(8,8);
533     Object JavaDoc maximumThumbSize = new DimensionUIResource(4096,4096);
534
535     // ** Slider value objects
536

537     Object JavaDoc sliderFocusInsets = twoInsets;
538
539     Object JavaDoc toolBarSeparatorSize = new DimensionUIResource( 10, 10 );
540
541
542     // *** SplitPane value objects
543

544     Object JavaDoc splitPaneBorder =
545         new SwingLazyValue(
546                 "javax.swing.plaf.basic.BasicBorders",
547                 "getSplitPaneBorder");
548     Object JavaDoc splitPaneDividerBorder =
549         new SwingLazyValue(
550                 "javax.swing.plaf.basic.BasicBorders",
551                 "getSplitPaneDividerBorder");
552
553     // ** TabbedBane value objects
554

555         Object JavaDoc tabbedPaneTabInsets = new InsetsUIResource(0, 4, 1, 4);
556
557         Object JavaDoc tabbedPaneTabPadInsets = new InsetsUIResource(2, 2, 2, 1);
558
559         Object JavaDoc tabbedPaneTabAreaInsets = new InsetsUIResource(3, 2, 0, 2);
560
561         Object JavaDoc tabbedPaneContentBorderInsets = new InsetsUIResource(2, 2, 3, 3);
562
563
564     // *** Text value objects
565

566     Object JavaDoc textFieldBorder =
567         new SwingLazyValue(
568                 "javax.swing.plaf.basic.BasicBorders",
569                 "getTextFieldBorder");
570
571         Object JavaDoc editorMargin = new InsetsUIResource(3,3,3,3);
572
573     Object JavaDoc caretBlinkRate = fiveHundred;
574     Integer JavaDoc four = new Integer JavaDoc(4);
575
576     Object JavaDoc[] allAuditoryCues = new Object JavaDoc[] {
577         "CheckBoxMenuItem.commandSound",
578         "InternalFrame.closeSound",
579         "InternalFrame.maximizeSound",
580         "InternalFrame.minimizeSound",
581         "InternalFrame.restoreDownSound",
582         "InternalFrame.restoreUpSound",
583         "MenuItem.commandSound",
584         "OptionPane.errorSound",
585         "OptionPane.informationSound",
586         "OptionPane.questionSound",
587         "OptionPane.warningSound",
588         "PopupMenu.popupSound",
589         "RadioButtonMenuItem.commandSound"};
590
591     Object JavaDoc[] noAuditoryCues = new Object JavaDoc[] {"mute"};
592
593         // *** Component Defaults
594

595     Object JavaDoc[] defaults = {
596         // *** Auditory Feedback
597
"AuditoryCues.cueList", allAuditoryCues,
598         "AuditoryCues.allAuditoryCues", allAuditoryCues,
599         "AuditoryCues.noAuditoryCues", noAuditoryCues,
600         // this key defines which of the various cues to render.
601
// L&Fs that want auditory feedback NEED to override playList.
602
"AuditoryCues.playList", null,
603
604         // *** Buttons
605
"Button.defaultButtonFollowsFocus", Boolean.TRUE,
606         "Button.font", dialogPlain12,
607         "Button.background", control,
608         "Button.foreground", controlText,
609         "Button.shadow", controlShadow,
610             "Button.darkShadow", controlDkShadow,
611             "Button.light", controlHighlight,
612             "Button.highlight", controlLtHighlight,
613         "Button.border", buttonBorder,
614         "Button.margin", new InsetsUIResource(2, 14, 2, 14),
615         "Button.textIconGap", four,
616         "Button.textShiftOffset", zero,
617         "Button.focusInputMap", new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
618                          "SPACE", "pressed",
619                 "released SPACE", "released",
620                          "ENTER", "pressed",
621                 "released ENTER", "released"
622               }),
623
624         "ToggleButton.font", dialogPlain12,
625         "ToggleButton.background", control,
626         "ToggleButton.foreground", controlText,
627         "ToggleButton.shadow", controlShadow,
628             "ToggleButton.darkShadow", controlDkShadow,
629             "ToggleButton.light", controlHighlight,
630             "ToggleButton.highlight", controlLtHighlight,
631         "ToggleButton.border", buttonToggleBorder,
632         "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
633         "ToggleButton.textIconGap", four,
634         "ToggleButton.textShiftOffset", zero,
635         "ToggleButton.focusInputMap",
636           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
637                     "SPACE", "pressed",
638                    "released SPACE", "released"
639             }),
640
641         "RadioButton.font", dialogPlain12,
642         "RadioButton.background", control,
643         "RadioButton.foreground", controlText,
644         "RadioButton.shadow", controlShadow,
645             "RadioButton.darkShadow", controlDkShadow,
646             "RadioButton.light", controlHighlight,
647             "RadioButton.highlight", controlLtHighlight,
648         "RadioButton.border", radioButtonBorder,
649         "RadioButton.margin", twoInsets,
650         "RadioButton.textIconGap", four,
651         "RadioButton.textShiftOffset", zero,
652         "RadioButton.icon", radioButtonIcon,
653         "RadioButton.focusInputMap",
654            new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
655                           "SPACE", "pressed",
656                  "released SPACE", "released",
657              "RETURN", "pressed"
658           }),
659
660         "CheckBox.font", dialogPlain12,
661         "CheckBox.background", control,
662         "CheckBox.foreground", controlText,
663         "CheckBox.border", radioButtonBorder,
664         "CheckBox.margin", twoInsets,
665         "CheckBox.textIconGap", four,
666         "CheckBox.textShiftOffset", zero,
667         "CheckBox.icon", checkBoxIcon,
668         "CheckBox.focusInputMap",
669            new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
670                     "SPACE", "pressed",
671                    "released SPACE", "released"
672          }),
673         "FileChooser.useSystemExtensionHiding", Boolean.FALSE,
674
675         // *** ColorChooser
676
"ColorChooser.font", dialogPlain12,
677             "ColorChooser.background", control,
678             "ColorChooser.foreground", controlText,
679
680             "ColorChooser.swatchesSwatchSize", new Dimension JavaDoc(10, 10),
681             "ColorChooser.swatchesRecentSwatchSize", new Dimension JavaDoc(10, 10),
682             "ColorChooser.swatchesDefaultRecentColor", control,
683
684         // *** ComboBox
685
"ComboBox.font", sansSerifPlain12,
686             "ComboBox.background", window,
687             "ComboBox.foreground", textText,
688         "ComboBox.buttonBackground", control,
689         "ComboBox.buttonShadow", controlShadow,
690         "ComboBox.buttonDarkShadow", controlDkShadow,
691         "ComboBox.buttonHighlight", controlLtHighlight,
692             "ComboBox.selectionBackground", textHighlight,
693             "ComboBox.selectionForeground", textHighlightText,
694             "ComboBox.disabledBackground", control,
695             "ComboBox.disabledForeground", textInactiveText,
696         "ComboBox.timeFactor", oneThousand,
697         "ComboBox.ancestorInputMap",
698            new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
699               "ESCAPE", "hidePopup",
700              "PAGE_UP", "pageUpPassThrough",
701            "PAGE_DOWN", "pageDownPassThrough",
702                 "HOME", "homePassThrough",
703                  "END", "endPassThrough",
704                "ENTER", "enterPressed"
705          }),
706  
707         // *** FileChooser
708

709         "FileChooser.newFolderIcon", newFolderIcon,
710             "FileChooser.upFolderIcon", upFolderIcon,
711             "FileChooser.homeFolderIcon", homeFolderIcon,
712             "FileChooser.detailsViewIcon", detailsViewIcon,
713             "FileChooser.listViewIcon", listViewIcon,
714         "FileChooser.readOnly", Boolean.FALSE,
715         "FileChooser.usesSingleFilePane", Boolean.FALSE,
716         "FileChooser.ancestorInputMap",
717            new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
718              "ESCAPE", "cancelSelection",
719              "F5", "refresh",
720          }),
721
722             "FileView.directoryIcon", directoryIcon,
723             "FileView.fileIcon", fileIcon,
724             "FileView.computerIcon", computerIcon,
725             "FileView.hardDriveIcon", hardDriveIcon,
726             "FileView.floppyDriveIcon", floppyDriveIcon,
727
728         // *** InternalFrame
729
"InternalFrame.titleFont", dialogBold12,
730         "InternalFrame.borderColor", control,
731         "InternalFrame.borderShadow", controlShadow,
732         "InternalFrame.borderDarkShadow", controlDkShadow,
733         "InternalFrame.borderHighlight", controlLtHighlight,
734         "InternalFrame.borderLight", controlHighlight,
735         "InternalFrame.border", internalFrameBorder,
736             "InternalFrame.icon", SwingUtilities2.makeIcon(getClass(),
737                                                              BasicLookAndFeel JavaDoc.class,
738                                                              "icons/JavaCup16.png"),
739
740             /* Default frame icons are undefined for Basic. */
741             "InternalFrame.maximizeIcon",
742         new SwingLazyValue(
743                "javax.swing.plaf.basic.BasicIconFactory",
744                "createEmptyFrameIcon"),
745             "InternalFrame.minimizeIcon",
746         new SwingLazyValue(
747                "javax.swing.plaf.basic.BasicIconFactory",
748                "createEmptyFrameIcon"),
749             "InternalFrame.iconifyIcon",
750         new SwingLazyValue(
751                "javax.swing.plaf.basic.BasicIconFactory",
752                "createEmptyFrameIcon"),
753             "InternalFrame.closeIcon",
754         new SwingLazyValue(
755                "javax.swing.plaf.basic.BasicIconFactory",
756                "createEmptyFrameIcon"),
757         // InternalFrame Auditory Cue Mappings
758
"InternalFrame.closeSound", null,
759             "InternalFrame.maximizeSound", null,
760             "InternalFrame.minimizeSound", null,
761             "InternalFrame.restoreDownSound", null,
762             "InternalFrame.restoreUpSound", null,
763
764         "InternalFrame.activeTitleBackground", table.get("activeCaption"),
765         "InternalFrame.activeTitleForeground", table.get("activeCaptionText"),
766         "InternalFrame.inactiveTitleBackground", table.get("inactiveCaption"),
767         "InternalFrame.inactiveTitleForeground", table.get("inactiveCaptionText"),
768         "InternalFrame.windowBindings", new Object JavaDoc[] {
769           "shift ESCAPE", "showSystemMenu",
770         "ctrl SPACE", "showSystemMenu",
771                 "ESCAPE", "hideSystemMenu"},
772
773         "DesktopIcon.border", internalFrameBorder,
774
775         "Desktop.background", table.get("desktop"),
776         "Desktop.ancestorInputMap",
777            new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
778          "ctrl F5", "restore",
779          "ctrl F4", "close",
780          "ctrl F7", "move",
781          "ctrl F8", "resize",
782            "RIGHT", "right",
783         "KP_RIGHT", "right",
784              "shift RIGHT", "shrinkRight",
785           "shift KP_RIGHT", "shrinkRight",
786             "LEFT", "left",
787          "KP_LEFT", "left",
788               "shift LEFT", "shrinkLeft",
789            "shift KP_LEFT", "shrinkLeft",
790               "UP", "up",
791            "KP_UP", "up",
792                 "shift UP", "shrinkUp",
793              "shift KP_UP", "shrinkUp",
794             "DOWN", "down",
795          "KP_DOWN", "down",
796               "shift DOWN", "shrinkDown",
797            "shift KP_DOWN", "shrinkDown",
798           "ESCAPE", "escape",
799          "ctrl F9", "minimize",
800         "ctrl F10", "maximize",
801          "ctrl F6", "selectNextFrame",
802         "ctrl TAB", "selectNextFrame",
803          "ctrl alt F6", "selectNextFrame",
804        "shift ctrl alt F6", "selectPreviousFrame",
805                 "ctrl F12", "navigateNext",
806           "shift ctrl F12", "navigatePrevious"
807           }),
808
809         // *** Label
810
"Label.font", dialogPlain12,
811         "Label.background", control,
812         "Label.foreground", controlText,
813         "Label.disabledForeground", white,
814         "Label.disabledShadow", controlShadow,
815             "Label.border", null,
816
817         // *** List
818
"List.font", dialogPlain12,
819         "List.background", window,
820         "List.foreground", textText,
821         "List.selectionBackground", textHighlight,
822         "List.selectionForeground", textHighlightText,
823         "List.focusCellHighlightBorder", focusCellHighlightBorder,
824         "List.border", null,
825         "List.cellRenderer", listCellRendererActiveValue,
826         "List.timeFactor", oneThousand,
827         "List.focusInputMap",
828            new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
829                            "ctrl C", "copy",
830                            "ctrl V", "paste",
831                            "ctrl X", "cut",
832                              "COPY", "copy",
833                             "PASTE", "paste",
834                               "CUT", "cut",
835                        "UP", "selectPreviousRow",
836                     "KP_UP", "selectPreviousRow",
837                  "shift UP", "selectPreviousRowExtendSelection",
838               "shift KP_UP", "selectPreviousRowExtendSelection",
839                     "ctrl shift UP", "selectPreviousRowExtendSelection",
840                  "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
841                           "ctrl UP", "selectPreviousRowChangeLead",
842                        "ctrl KP_UP", "selectPreviousRowChangeLead",
843                      "DOWN", "selectNextRow",
844                   "KP_DOWN", "selectNextRow",
845                "shift DOWN", "selectNextRowExtendSelection",
846             "shift KP_DOWN", "selectNextRowExtendSelection",
847                   "ctrl shift DOWN", "selectNextRowExtendSelection",
848                "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
849                         "ctrl DOWN", "selectNextRowChangeLead",
850                      "ctrl KP_DOWN", "selectNextRowChangeLead",
851                      "LEFT", "selectPreviousColumn",
852                   "KP_LEFT", "selectPreviousColumn",
853                "shift LEFT", "selectPreviousColumnExtendSelection",
854             "shift KP_LEFT", "selectPreviousColumnExtendSelection",
855                   "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
856                "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
857                         "ctrl LEFT", "selectPreviousColumnChangeLead",
858                      "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
859                     "RIGHT", "selectNextColumn",
860                  "KP_RIGHT", "selectNextColumn",
861               "shift RIGHT", "selectNextColumnExtendSelection",
862            "shift KP_RIGHT", "selectNextColumnExtendSelection",
863                  "ctrl shift RIGHT", "selectNextColumnExtendSelection",
864               "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
865                        "ctrl RIGHT", "selectNextColumnChangeLead",
866                     "ctrl KP_RIGHT", "selectNextColumnChangeLead",
867                      "HOME", "selectFirstRow",
868                "shift HOME", "selectFirstRowExtendSelection",
869                   "ctrl shift HOME", "selectFirstRowExtendSelection",
870                         "ctrl HOME", "selectFirstRowChangeLead",
871                       "END", "selectLastRow",
872                 "shift END", "selectLastRowExtendSelection",
873                    "ctrl shift END", "selectLastRowExtendSelection",
874                          "ctrl END", "selectLastRowChangeLead",
875                   "PAGE_UP", "scrollUp",
876             "shift PAGE_UP", "scrollUpExtendSelection",
877                "ctrl shift PAGE_UP", "scrollUpExtendSelection",
878                      "ctrl PAGE_UP", "scrollUpChangeLead",
879                 "PAGE_DOWN", "scrollDown",
880           "shift PAGE_DOWN", "scrollDownExtendSelection",
881              "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
882                    "ctrl PAGE_DOWN", "scrollDownChangeLead",
883                    "ctrl A", "selectAll",
884                "ctrl SLASH", "selectAll",
885           "ctrl BACK_SLASH", "clearSelection",
886                             "SPACE", "addToSelection",
887                        "ctrl SPACE", "toggleAndAnchor",
888                       "shift SPACE", "extendTo",
889                  "ctrl shift SPACE", "moveSelectionTo"
890          }),
891         "List.focusInputMap.RightToLeft",
892            new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
893                      "LEFT", "selectNextColumn",
894                   "KP_LEFT", "selectNextColumn",
895                "shift LEFT", "selectNextColumnExtendSelection",
896             "shift KP_LEFT", "selectNextColumnExtendSelection",
897                   "ctrl shift LEFT", "selectNextColumnExtendSelection",
898                "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
899                         "ctrl LEFT", "selectNextColumnChangeLead",
900                      "ctrl KP_LEFT", "selectNextColumnChangeLead",
901                     "RIGHT", "selectPreviousColumn",
902                  "KP_RIGHT", "selectPreviousColumn",
903               "shift RIGHT", "selectPreviousColumnExtendSelection",
904            "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
905                  "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
906               "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
907                        "ctrl RIGHT", "selectPreviousColumnChangeLead",
908                     "ctrl KP_RIGHT", "selectPreviousColumnChangeLead",
909          }),
910
911         // *** Menus
912
"MenuBar.font", dialogPlain12,
913         "MenuBar.background", menu,
914         "MenuBar.foreground", menuText,
915         "MenuBar.shadow", controlShadow,
916             "MenuBar.highlight", controlLtHighlight,
917         "MenuBar.border", menuBarBorder,
918         "MenuBar.windowBindings", new Object JavaDoc[] {
919         "F10", "takeFocus" },
920
921         "MenuItem.font", dialogPlain12,
922         "MenuItem.acceleratorFont", dialogPlain12,
923         "MenuItem.background", menu,
924         "MenuItem.foreground", menuText,
925         "MenuItem.selectionForeground", textHighlightText,
926         "MenuItem.selectionBackground", textHighlight,
927         "MenuItem.disabledForeground", null,
928         "MenuItem.acceleratorForeground", menuText,
929         "MenuItem.acceleratorSelectionForeground", textHighlightText,
930         "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
931         "MenuItem.border", marginBorder,
932         "MenuItem.borderPainted", Boolean.FALSE,
933         "MenuItem.margin", twoInsets,
934         "MenuItem.checkIcon", menuItemCheckIcon,
935         "MenuItem.arrowIcon", menuItemArrowIcon,
936         "MenuItem.commandSound", null,
937
938         "RadioButtonMenuItem.font", dialogPlain12,
939         "RadioButtonMenuItem.acceleratorFont", dialogPlain12,
940         "RadioButtonMenuItem.background", menu,
941         "RadioButtonMenuItem.foreground", menuText,
942         "RadioButtonMenuItem.selectionForeground", textHighlightText,
943         "RadioButtonMenuItem.selectionBackground", textHighlight,
944         "RadioButtonMenuItem.disabledForeground", null,
945         "RadioButtonMenuItem.acceleratorForeground", menuText,
946         "RadioButtonMenuItem.acceleratorSelectionForeground", textHighlightText,
947         "RadioButtonMenuItem.border", marginBorder,
948         "RadioButtonMenuItem.borderPainted", Boolean.FALSE,
949         "RadioButtonMenuItem.margin", twoInsets,
950         "RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon,
951         "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon,
952         "RadioButtonMenuItem.commandSound", null,
953
954         "CheckBoxMenuItem.font", dialogPlain12,
955         "CheckBoxMenuItem.acceleratorFont", dialogPlain12,
956         "CheckBoxMenuItem.background", menu,
957         "CheckBoxMenuItem.foreground", menuText,
958         "CheckBoxMenuItem.selectionForeground", textHighlightText,
959         "CheckBoxMenuItem.selectionBackground", textHighlight,
960         "CheckBoxMenuItem.disabledForeground", null,
961         "CheckBoxMenuItem.acceleratorForeground", menuText,
962         "CheckBoxMenuItem.acceleratorSelectionForeground", textHighlightText,
963         "CheckBoxMenuItem.border", marginBorder,
964         "CheckBoxMenuItem.borderPainted", Boolean.FALSE,
965         "CheckBoxMenuItem.margin", twoInsets,
966         "CheckBoxMenuItem.checkIcon", checkBoxMenuItemIcon,
967         "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon,
968         "CheckBoxMenuItem.commandSound", null,
969
970         "Menu.font", dialogPlain12,
971         "Menu.acceleratorFont", dialogPlain12,
972         "Menu.background", menu,
973         "Menu.foreground", menuText,
974         "Menu.selectionForeground", textHighlightText,
975         "Menu.selectionBackground", textHighlight,
976         "Menu.disabledForeground", null,
977         "Menu.acceleratorForeground", menuText,
978         "Menu.acceleratorSelectionForeground", textHighlightText,
979         "Menu.border", marginBorder,
980         "Menu.borderPainted", Boolean.FALSE,
981         "Menu.margin", twoInsets,
982         "Menu.checkIcon", menuItemCheckIcon,
983         "Menu.arrowIcon", menuArrowIcon,
984         "Menu.menuPopupOffsetX", new Integer JavaDoc(0),
985         "Menu.menuPopupOffsetY", new Integer JavaDoc(0),
986         "Menu.submenuPopupOffsetX", new Integer JavaDoc(0),
987         "Menu.submenuPopupOffsetY", new Integer JavaDoc(0),
988         "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK},
989             "Menu.crossMenuMnemonic", Boolean.TRUE,
990
991         // PopupMenu
992
"PopupMenu.font", dialogPlain12,
993         "PopupMenu.background", menu,
994         "PopupMenu.foreground", menuText,
995         "PopupMenu.border", popupMenuBorder,
996              // Internal Frame Auditory Cue Mappings
997
"PopupMenu.popupSound", null,
998         // These window InputMap bindings are used when the Menu is
999
// selected.
1000
"PopupMenu.selectedWindowInputMapBindings", new Object JavaDoc[] {
1001          "ESCAPE", "cancel",
1002                    "DOWN", "selectNext",
1003         "KP_DOWN", "selectNext",
1004              "UP", "selectPrevious",
1005           "KP_UP", "selectPrevious",
1006            "LEFT", "selectParent",
1007         "KP_LEFT", "selectParent",
1008           "RIGHT", "selectChild",
1009        "KP_RIGHT", "selectChild",
1010           "ENTER", "return",
1011           "SPACE", "return"
1012        },
1013        "PopupMenu.selectedWindowInputMapBindings.RightToLeft", new Object JavaDoc[] {
1014            "LEFT", "selectChild",
1015         "KP_LEFT", "selectChild",
1016           "RIGHT", "selectParent",
1017        "KP_RIGHT", "selectParent",
1018        },
1019            "PopupMenu.consumeEventOnClose", Boolean.FALSE,
1020
1021        // *** OptionPane
1022
// You can additionaly define OptionPane.messageFont which will
1023
// dictate the fonts used for the message, and
1024
// OptionPane.buttonFont, which defines the font for the buttons.
1025
"OptionPane.font", dialogPlain12,
1026        "OptionPane.background", control,
1027        "OptionPane.foreground", controlText,
1028            "OptionPane.messageForeground", controlText,
1029        "OptionPane.border", optionPaneBorder,
1030            "OptionPane.messageAreaBorder", zeroBorder,
1031            "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder,
1032            "OptionPane.minimumSize", optionPaneMinimumSize,
1033            "OptionPane.errorIcon", SwingUtilities2.makeIcon(getClass(),
1034                                                             BasicLookAndFeel JavaDoc.class,
1035                                                             "icons/Error.gif"),
1036            "OptionPane.informationIcon", SwingUtilities2.makeIcon(getClass(),
1037                                                                   BasicLookAndFeel JavaDoc.class,
1038                                                                   "icons/Inform.gif"),
1039            "OptionPane.warningIcon", SwingUtilities2.makeIcon(getClass(),
1040                                                               BasicLookAndFeel JavaDoc.class,
1041                                                               "icons/Warn.gif"),
1042            "OptionPane.questionIcon", SwingUtilities2.makeIcon(getClass(),
1043                                                                BasicLookAndFeel JavaDoc.class,
1044                                                                "icons/Question.gif"),
1045        "OptionPane.windowBindings", new Object JavaDoc[] {
1046        "ESCAPE", "close" },
1047             // OptionPane Auditory Cue Mappings
1048
"OptionPane.errorSound", null,
1049            "OptionPane.informationSound", null, // Info and Plain
1050
"OptionPane.questionSound", null,
1051            "OptionPane.warningSound", null,
1052        "OptionPane.buttonClickThreshhold", fiveHundred,
1053
1054        // *** Panel
1055
"Panel.font", dialogPlain12,
1056        "Panel.background", control,
1057        "Panel.foreground", textText,
1058
1059        // *** ProgressBar
1060
"ProgressBar.font", dialogPlain12,
1061        "ProgressBar.foreground", textHighlight,
1062        "ProgressBar.background", control,
1063        "ProgressBar.selectionForeground", control,
1064        "ProgressBar.selectionBackground", textHighlight,
1065        "ProgressBar.border", progressBarBorder,
1066            "ProgressBar.cellLength", new Integer JavaDoc(1),
1067            "ProgressBar.cellSpacing", zero,
1068            "ProgressBar.repaintInterval", new Integer JavaDoc(50),
1069            "ProgressBar.cycleTime", new Integer JavaDoc(3000),
1070            "ProgressBar.horizontalSize", new DimensionUIResource(146, 12),
1071            "ProgressBar.verticalSize", new DimensionUIResource(12, 146),
1072
1073           // *** Separator
1074
"Separator.shadow", controlShadow, // DEPRECATED - DO NOT USE!
1075
"Separator.highlight", controlLtHighlight, // DEPRECATED - DO NOT USE!
1076

1077            "Separator.background", controlLtHighlight,
1078            "Separator.foreground", controlShadow,
1079
1080        // *** ScrollBar/ScrollPane/Viewport
1081
"ScrollBar.background", scrollBarTrack,
1082        "ScrollBar.foreground", control,
1083        "ScrollBar.track", table.get("scrollbar"),
1084        "ScrollBar.trackHighlight", controlDkShadow,
1085        "ScrollBar.thumb", control,
1086        "ScrollBar.thumbHighlight", controlLtHighlight,
1087        "ScrollBar.thumbDarkShadow", controlDkShadow,
1088        "ScrollBar.thumbShadow", controlShadow,
1089        "ScrollBar.border", null,
1090        "ScrollBar.minimumThumbSize", minimumThumbSize,
1091        "ScrollBar.maximumThumbSize", maximumThumbSize,
1092        "ScrollBar.ancestorInputMap",
1093           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1094               "RIGHT", "positiveUnitIncrement",
1095            "KP_RIGHT", "positiveUnitIncrement",
1096                "DOWN", "positiveUnitIncrement",
1097             "KP_DOWN", "positiveUnitIncrement",
1098           "PAGE_DOWN", "positiveBlockIncrement",
1099                "LEFT", "negativeUnitIncrement",
1100             "KP_LEFT", "negativeUnitIncrement",
1101                  "UP", "negativeUnitIncrement",
1102               "KP_UP", "negativeUnitIncrement",
1103             "PAGE_UP", "negativeBlockIncrement",
1104                "HOME", "minScroll",
1105                 "END", "maxScroll"
1106         }),
1107        "ScrollBar.ancestorInputMap.RightToLeft",
1108           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1109               "RIGHT", "negativeUnitIncrement",
1110            "KP_RIGHT", "negativeUnitIncrement",
1111                "LEFT", "positiveUnitIncrement",
1112             "KP_LEFT", "positiveUnitIncrement",
1113         }),
1114            "ScrollBar.width", new Integer JavaDoc(16),
1115
1116        "ScrollPane.font", dialogPlain12,
1117        "ScrollPane.background", control,
1118        "ScrollPane.foreground", controlText,
1119        "ScrollPane.border", textFieldBorder,
1120        "ScrollPane.viewportBorder", null,
1121        "ScrollPane.ancestorInputMap",
1122           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1123                   "RIGHT", "unitScrollRight",
1124                "KP_RIGHT", "unitScrollRight",
1125                    "DOWN", "unitScrollDown",
1126                 "KP_DOWN", "unitScrollDown",
1127                    "LEFT", "unitScrollLeft",
1128                 "KP_LEFT", "unitScrollLeft",
1129                      "UP", "unitScrollUp",
1130                   "KP_UP", "unitScrollUp",
1131                 "PAGE_UP", "scrollUp",
1132               "PAGE_DOWN", "scrollDown",
1133            "ctrl PAGE_UP", "scrollLeft",
1134          "ctrl PAGE_DOWN", "scrollRight",
1135               "ctrl HOME", "scrollHome",
1136                "ctrl END", "scrollEnd"
1137         }),
1138        "ScrollPane.ancestorInputMap.RightToLeft",
1139           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1140            "ctrl PAGE_UP", "scrollRight",
1141          "ctrl PAGE_DOWN", "scrollLeft",
1142         }),
1143
1144        "Viewport.font", dialogPlain12,
1145        "Viewport.background", control,
1146        "Viewport.foreground", textText,
1147
1148        // *** Slider
1149
"Slider.foreground", control,
1150        "Slider.background", control,
1151        "Slider.highlight", controlLtHighlight,
1152            "Slider.tickColor", Color.black,
1153        "Slider.shadow", controlShadow,
1154        "Slider.focus", controlDkShadow,
1155        "Slider.border", null,
1156            "Slider.horizontalSize", new Dimension JavaDoc(200, 21),
1157            "Slider.verticalSize", new Dimension JavaDoc(21, 200),
1158            "Slider.minimumHorizontalSize", new Dimension JavaDoc(36, 21),
1159            "Slider.minimumVerticalSize", new Dimension JavaDoc(21, 36),
1160        "Slider.focusInsets", sliderFocusInsets,
1161        "Slider.focusInputMap",
1162           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1163               "RIGHT", "positiveUnitIncrement",
1164            "KP_RIGHT", "positiveUnitIncrement",
1165                "DOWN", "negativeUnitIncrement",
1166             "KP_DOWN", "negativeUnitIncrement",
1167           "PAGE_DOWN", "negativeBlockIncrement",
1168                "LEFT", "negativeUnitIncrement",
1169             "KP_LEFT", "negativeUnitIncrement",
1170                  "UP", "positiveUnitIncrement",
1171               "KP_UP", "positiveUnitIncrement",
1172             "PAGE_UP", "positiveBlockIncrement",
1173                "HOME", "minScroll",
1174                 "END", "maxScroll"
1175         }),
1176        "Slider.focusInputMap.RightToLeft",
1177           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1178               "RIGHT", "negativeUnitIncrement",
1179            "KP_RIGHT", "negativeUnitIncrement",
1180                "LEFT", "positiveUnitIncrement",
1181             "KP_LEFT", "positiveUnitIncrement",
1182         }),
1183
1184        // *** Spinner
1185
"Spinner.font", monospacedPlain12,
1186        "Spinner.background", control,
1187        "Spinner.foreground", control,
1188        "Spinner.border", textFieldBorder,
1189        "Spinner.arrowButtonBorder", null,
1190        "Spinner.arrowButtonInsets", null,
1191        "Spinner.arrowButtonSize", new Dimension JavaDoc(16, 5),
1192            "Spinner.ancestorInputMap",
1193           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1194                               "UP", "increment",
1195                            "KP_UP", "increment",
1196                             "DOWN", "decrement",
1197                          "KP_DOWN", "decrement",
1198               }),
1199        "Spinner.editorBorderPainted", Boolean.FALSE,
1200
1201        // *** SplitPane
1202
"SplitPane.background", control,
1203        "SplitPane.highlight", controlLtHighlight,
1204        "SplitPane.shadow", controlShadow,
1205        "SplitPane.darkShadow", controlDkShadow,
1206        "SplitPane.border", splitPaneBorder,
1207        "SplitPane.dividerSize", new Integer JavaDoc(7),
1208        "SplitPaneDivider.border", splitPaneDividerBorder,
1209        "SplitPaneDivider.draggingColor", darkGray,
1210        "SplitPane.ancestorInputMap",
1211           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1212                "UP", "negativeIncrement",
1213              "DOWN", "positiveIncrement",
1214              "LEFT", "negativeIncrement",
1215             "RIGHT", "positiveIncrement",
1216             "KP_UP", "negativeIncrement",
1217           "KP_DOWN", "positiveIncrement",
1218           "KP_LEFT", "negativeIncrement",
1219          "KP_RIGHT", "positiveIncrement",
1220              "HOME", "selectMin",
1221               "END", "selectMax",
1222                "F8", "startResize",
1223                "F6", "toggleFocus",
1224          "ctrl TAB", "focusOutForward",
1225        "ctrl shift TAB", "focusOutBackward"
1226         }),
1227
1228        // *** TabbedPane
1229
"TabbedPane.font", dialogPlain12,
1230            "TabbedPane.background", control,
1231            "TabbedPane.foreground", controlText,
1232            "TabbedPane.highlight", controlLtHighlight,
1233            "TabbedPane.light", controlHighlight,
1234            "TabbedPane.shadow", controlShadow,
1235            "TabbedPane.darkShadow", controlDkShadow,
1236        "TabbedPane.selected", null,
1237            "TabbedPane.focus", controlText,
1238            "TabbedPane.textIconGap", four,
1239
1240        // Causes tabs to be painted on top of the content area border.
1241
// The amount of overlap is then controlled by tabAreaInsets.bottom,
1242
// which is zero by default
1243
"TabbedPane.tabsOverlapBorder", Boolean.FALSE,
1244
1245            "TabbedPane.tabInsets", tabbedPaneTabInsets,
1246            "TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets,
1247            "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
1248            "TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets,
1249            "TabbedPane.tabRunOverlay", new Integer JavaDoc(2),
1250            "TabbedPane.tabsOpaque", Boolean.TRUE,
1251            "TabbedPane.contentOpaque", Boolean.TRUE,
1252        "TabbedPane.focusInputMap",
1253          new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1254                 "RIGHT", "navigateRight",
1255                  "KP_RIGHT", "navigateRight",
1256                      "LEFT", "navigateLeft",
1257                   "KP_LEFT", "navigateLeft",
1258                        "UP", "navigateUp",
1259                     "KP_UP", "navigateUp",
1260                      "DOWN", "navigateDown",
1261                   "KP_DOWN", "navigateDown",
1262                 "ctrl DOWN", "requestFocusForVisibleComponent",
1263              "ctrl KP_DOWN", "requestFocusForVisibleComponent",
1264        }),
1265        "TabbedPane.ancestorInputMap",
1266           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1267           "ctrl PAGE_DOWN", "navigatePageDown",
1268                 "ctrl PAGE_UP", "navigatePageUp",
1269                      "ctrl UP", "requestFocus",
1270                   "ctrl KP_UP", "requestFocus",
1271         }),
1272
1273
1274        // *** Table
1275
"Table.font", dialogPlain12,
1276        "Table.foreground", controlText, // cell text color
1277
"Table.background", window, // cell background color
1278
"Table.selectionForeground", textHighlightText,
1279        "Table.selectionBackground", textHighlight,
1280            "Table.gridColor", gray, // grid line color
1281
"Table.focusCellBackground", window,
1282            "Table.focusCellForeground", controlText,
1283        "Table.focusCellHighlightBorder", focusCellHighlightBorder,
1284        "Table.scrollPaneBorder", loweredBevelBorder,
1285        "Table.ancestorInputMap",
1286           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1287                               "ctrl C", "copy",
1288                               "ctrl V", "paste",
1289                               "ctrl X", "cut",
1290                                 "COPY", "copy",
1291                                "PASTE", "paste",
1292                                  "CUT", "cut",
1293                                "RIGHT", "selectNextColumn",
1294                             "KP_RIGHT", "selectNextColumn",
1295                          "shift RIGHT", "selectNextColumnExtendSelection",
1296                       "shift KP_RIGHT", "selectNextColumnExtendSelection",
1297                     "ctrl shift RIGHT", "selectNextColumnExtendSelection",
1298                  "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
1299                           "ctrl RIGHT", "selectNextColumnChangeLead",
1300                        "ctrl KP_RIGHT", "selectNextColumnChangeLead",
1301                                 "LEFT", "selectPreviousColumn",
1302                              "KP_LEFT", "selectPreviousColumn",
1303                           "shift LEFT", "selectPreviousColumnExtendSelection",
1304                        "shift KP_LEFT", "selectPreviousColumnExtendSelection",
1305                      "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
1306                   "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
1307                            "ctrl LEFT", "selectPreviousColumnChangeLead",
1308                         "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
1309                                 "DOWN", "selectNextRow",
1310                              "KP_DOWN", "selectNextRow",
1311                           "shift DOWN", "selectNextRowExtendSelection",
1312                        "shift KP_DOWN", "selectNextRowExtendSelection",
1313                      "ctrl shift DOWN", "selectNextRowExtendSelection",
1314                   "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
1315                            "ctrl DOWN", "selectNextRowChangeLead",
1316                         "ctrl KP_DOWN", "selectNextRowChangeLead",
1317                                   "UP", "selectPreviousRow",
1318                                "KP_UP", "selectPreviousRow",
1319                             "shift UP", "selectPreviousRowExtendSelection",
1320                          "shift KP_UP", "selectPreviousRowExtendSelection",
1321                        "ctrl shift UP", "selectPreviousRowExtendSelection",
1322                     "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
1323                              "ctrl UP", "selectPreviousRowChangeLead",
1324                           "ctrl KP_UP", "selectPreviousRowChangeLead",
1325                                 "HOME", "selectFirstColumn",
1326                           "shift HOME", "selectFirstColumnExtendSelection",
1327                      "ctrl shift HOME", "selectFirstRowExtendSelection",
1328                            "ctrl HOME", "selectFirstRow",
1329                                  "END", "selectLastColumn",
1330                            "shift END", "selectLastColumnExtendSelection",
1331                       "ctrl shift END", "selectLastRowExtendSelection",
1332                             "ctrl END", "selectLastRow",
1333                              "PAGE_UP", "scrollUpChangeSelection",
1334                        "shift PAGE_UP", "scrollUpExtendSelection",
1335                   "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
1336                         "ctrl PAGE_UP", "scrollLeftChangeSelection",
1337                            "PAGE_DOWN", "scrollDownChangeSelection",
1338                      "shift PAGE_DOWN", "scrollDownExtendSelection",
1339                 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
1340                       "ctrl PAGE_DOWN", "scrollRightChangeSelection",
1341                                  "TAB", "selectNextColumnCell",
1342                            "shift TAB", "selectPreviousColumnCell",
1343                                "ENTER", "selectNextRowCell",
1344                          "shift ENTER", "selectPreviousRowCell",
1345                               "ctrl A", "selectAll",
1346                           "ctrl SLASH", "selectAll",
1347                      "ctrl BACK_SLASH", "clearSelection",
1348                               "ESCAPE", "cancel",
1349                                   "F2", "startEditing",
1350                                "SPACE", "addToSelection",
1351                           "ctrl SPACE", "toggleAndAnchor",
1352                          "shift SPACE", "extendTo",
1353                     "ctrl shift SPACE", "moveSelectionTo"
1354         }),
1355        "Table.ancestorInputMap.RightToLeft",
1356           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1357                        "RIGHT", "selectPreviousColumn",
1358                     "KP_RIGHT", "selectPreviousColumn",
1359                          "shift RIGHT", "selectPreviousColumnExtendSelection",
1360                       "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
1361                     "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
1362                  "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
1363                          "shift RIGHT", "selectPreviousColumnChangeLead",
1364                       "shift KP_RIGHT", "selectPreviousColumnChangeLead",
1365                         "LEFT", "selectNextColumn",
1366                      "KP_LEFT", "selectNextColumn",
1367                   "shift LEFT", "selectNextColumnExtendSelection",
1368                "shift KP_LEFT", "selectNextColumnExtendSelection",
1369                      "ctrl shift LEFT", "selectNextColumnExtendSelection",
1370                   "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
1371                            "ctrl LEFT", "selectNextColumnChangeLead",
1372                         "ctrl KP_LEFT", "selectNextColumnChangeLead",
1373                 "ctrl PAGE_UP", "scrollRightChangeSelection",
1374               "ctrl PAGE_DOWN", "scrollLeftChangeSelection",
1375           "ctrl shift PAGE_UP", "scrollRightExtendSelection",
1376         "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
1377         }),
1378
1379        "TableHeader.font", dialogPlain12,
1380        "TableHeader.foreground", controlText, // header text color
1381
"TableHeader.background", control, // header background
1382
"TableHeader.cellBorder", tableHeaderBorder,
1383
1384        // *** Text
1385
"TextField.font", sansSerifPlain12,
1386        "TextField.background", window,
1387        "TextField.foreground", textText,
1388            "TextField.shadow", controlShadow,
1389            "TextField.darkShadow", controlDkShadow,
1390            "TextField.light", controlHighlight,
1391            "TextField.highlight", controlLtHighlight,
1392        "TextField.inactiveForeground", textInactiveText,
1393        "TextField.inactiveBackground", control,
1394        "TextField.selectionBackground", textHighlight,
1395        "TextField.selectionForeground", textHighlightText,
1396        "TextField.caretForeground", textText,
1397        "TextField.caretBlinkRate", caretBlinkRate,
1398        "TextField.border", textFieldBorder,
1399            "TextField.margin", zeroInsets,
1400
1401        "FormattedTextField.font", sansSerifPlain12,
1402        "FormattedTextField.background", window,
1403        "FormattedTextField.foreground", textText,
1404        "FormattedTextField.inactiveForeground", textInactiveText,
1405        "FormattedTextField.inactiveBackground", control,
1406        "FormattedTextField.selectionBackground", textHighlight,
1407        "FormattedTextField.selectionForeground", textHighlightText,
1408        "FormattedTextField.caretForeground", textText,
1409        "FormattedTextField.caretBlinkRate", caretBlinkRate,
1410        "FormattedTextField.border", textFieldBorder,
1411            "FormattedTextField.margin", zeroInsets,
1412        "FormattedTextField.focusInputMap",
1413              new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1414                           "ctrl C", DefaultEditorKit.copyAction,
1415                           "ctrl V", DefaultEditorKit.pasteAction,
1416                           "ctrl X", DefaultEditorKit.cutAction,
1417                             "COPY", DefaultEditorKit.copyAction,
1418                            "PASTE", DefaultEditorKit.pasteAction,
1419                              "CUT", DefaultEditorKit.cutAction,
1420                       "shift LEFT", DefaultEditorKit.selectionBackwardAction,
1421                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
1422                      "shift RIGHT", DefaultEditorKit.selectionForwardAction,
1423                   "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
1424                        "ctrl LEFT", DefaultEditorKit.previousWordAction,
1425                     "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
1426                       "ctrl RIGHT", DefaultEditorKit.nextWordAction,
1427                    "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
1428                  "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
1429               "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
1430                 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
1431              "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
1432                           "ctrl A", DefaultEditorKit.selectAllAction,
1433                             "HOME", DefaultEditorKit.beginLineAction,
1434                              "END", DefaultEditorKit.endLineAction,
1435                       "shift HOME", DefaultEditorKit.selectionBeginLineAction,
1436                        "shift END", DefaultEditorKit.selectionEndLineAction,
1437                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
1438                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
1439                           "DELETE", DefaultEditorKit.deleteNextCharAction,
1440                            "RIGHT", DefaultEditorKit.forwardAction,
1441                             "LEFT", DefaultEditorKit.backwardAction,
1442                         "KP_RIGHT", DefaultEditorKit.forwardAction,
1443                          "KP_LEFT", DefaultEditorKit.backwardAction,
1444                            "ENTER", JTextField.notifyAction,
1445                  "ctrl BACK_SLASH", "unselect",
1446                  "control shift O", "toggle-componentOrientation",
1447                           "ESCAPE", "reset-field-edit",
1448                               "UP", "increment",
1449                            "KP_UP", "increment",
1450                             "DOWN", "decrement",
1451                          "KP_DOWN", "decrement",
1452              }),
1453
1454        "PasswordField.font", monospacedPlain12,
1455        "PasswordField.background", window,
1456        "PasswordField.foreground", textText,
1457        "PasswordField.inactiveForeground", textInactiveText,
1458        "PasswordField.inactiveBackground", control,
1459        "PasswordField.selectionBackground", textHighlight,
1460        "PasswordField.selectionForeground", textHighlightText,
1461        "PasswordField.caretForeground", textText,
1462        "PasswordField.caretBlinkRate", caretBlinkRate,
1463        "PasswordField.border", textFieldBorder,
1464            "PasswordField.margin", zeroInsets,
1465
1466        "TextArea.font", monospacedPlain12,
1467        "TextArea.background", window,
1468        "TextArea.foreground", textText,
1469        "TextArea.inactiveForeground", textInactiveText,
1470        "TextArea.selectionBackground", textHighlight,
1471        "TextArea.selectionForeground", textHighlightText,
1472        "TextArea.caretForeground", textText,
1473        "TextArea.caretBlinkRate", caretBlinkRate,
1474        "TextArea.border", marginBorder,
1475            "TextArea.margin", zeroInsets,
1476
1477        "TextPane.font", serifPlain12,
1478        "TextPane.background", white,
1479        "TextPane.foreground", textText,
1480        "TextPane.selectionBackground", textHighlight,
1481        "TextPane.selectionForeground", textHighlightText,
1482        "TextPane.caretForeground", textText,
1483        "TextPane.caretBlinkRate", caretBlinkRate,
1484        "TextPane.inactiveForeground", textInactiveText,
1485        "TextPane.border", marginBorder,
1486            "TextPane.margin", editorMargin,
1487
1488        "EditorPane.font", serifPlain12,
1489        "EditorPane.background", white,
1490        "EditorPane.foreground", textText,
1491        "EditorPane.selectionBackground", textHighlight,
1492        "EditorPane.selectionForeground", textHighlightText,
1493        "EditorPane.caretForeground", textText,
1494        "EditorPane.caretBlinkRate", caretBlinkRate,
1495        "EditorPane.inactiveForeground", textInactiveText,
1496        "EditorPane.border", marginBorder,
1497            "EditorPane.margin", editorMargin,
1498
1499        // *** TitledBorder
1500
"TitledBorder.font", dialogPlain12,
1501            "TitledBorder.titleColor", controlText,
1502            "TitledBorder.border", etchedBorder,
1503
1504        // *** ToolBar
1505
"ToolBar.font", dialogPlain12,
1506        "ToolBar.background", control,
1507        "ToolBar.foreground", controlText,
1508        "ToolBar.shadow", controlShadow,
1509            "ToolBar.darkShadow", controlDkShadow,
1510            "ToolBar.light", controlHighlight,
1511            "ToolBar.highlight", controlLtHighlight,
1512        "ToolBar.dockingBackground", control,
1513        "ToolBar.dockingForeground", red,
1514        "ToolBar.floatingBackground", control,
1515        "ToolBar.floatingForeground", darkGray,
1516        "ToolBar.border", etchedBorder,
1517        "ToolBar.separatorSize", toolBarSeparatorSize,
1518        "ToolBar.ancestorInputMap",
1519           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1520                "UP", "navigateUp",
1521             "KP_UP", "navigateUp",
1522              "DOWN", "navigateDown",
1523           "KP_DOWN", "navigateDown",
1524              "LEFT", "navigateLeft",
1525           "KP_LEFT", "navigateLeft",
1526             "RIGHT", "navigateRight",
1527          "KP_RIGHT", "navigateRight"
1528         }),
1529
1530        // *** ToolTips
1531
"ToolTip.font", sansSerifPlain12,
1532            "ToolTip.background", table.get("info"),
1533            "ToolTip.foreground", table.get("infoText"),
1534            "ToolTip.border", blackLineBorder,
1535            // ToolTips also support backgroundInactive, borderInactive,
1536
// and foregroundInactive
1537

1538        // *** Tree
1539
"Tree.paintLines", Boolean.TRUE,
1540        "Tree.lineTypeDashed", Boolean.FALSE,
1541        "Tree.font", dialogPlain12,
1542        "Tree.background", window,
1543            "Tree.foreground", textText,
1544        "Tree.hash", gray,
1545        "Tree.textForeground", textText,
1546        "Tree.textBackground", table.get("text"),
1547        "Tree.selectionForeground", textHighlightText,
1548        "Tree.selectionBackground", textHighlight,
1549        "Tree.selectionBorderColor", black,
1550        "Tree.editorBorder", blackLineBorder,
1551        "Tree.leftChildIndent", new Integer JavaDoc(7),
1552        "Tree.rightChildIndent", new Integer JavaDoc(13),
1553        "Tree.rowHeight", new Integer JavaDoc(16),
1554        "Tree.scrollsOnExpand", Boolean.TRUE,
1555            "Tree.openIcon", SwingUtilities2.makeIcon(getClass(),
1556                                                      BasicLookAndFeel JavaDoc.class,
1557                                                      "icons/TreeOpen.gif"),
1558            "Tree.closedIcon", SwingUtilities2.makeIcon(getClass(),
1559                                                        BasicLookAndFeel JavaDoc.class,
1560                                                        "icons/TreeClosed.gif"),
1561            "Tree.leafIcon", SwingUtilities2.makeIcon(getClass(),
1562                                                      BasicLookAndFeel JavaDoc.class,
1563                                                      "icons/TreeLeaf.gif"),
1564        "Tree.expandedIcon", null,
1565        "Tree.collapsedIcon", null,
1566        "Tree.changeSelectionWithFocus", Boolean.TRUE,
1567        "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE,
1568        "Tree.timeFactor", oneThousand,
1569        "Tree.focusInputMap",
1570           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1571                                 "ctrl C", "copy",
1572                                 "ctrl V", "paste",
1573                                 "ctrl X", "cut",
1574                                   "COPY", "copy",
1575                                  "PASTE", "paste",
1576                                    "CUT", "cut",
1577                             "UP", "selectPrevious",
1578                          "KP_UP", "selectPrevious",
1579                       "shift UP", "selectPreviousExtendSelection",
1580                    "shift KP_UP", "selectPreviousExtendSelection",
1581                          "ctrl shift UP", "selectPreviousExtendSelection",
1582                       "ctrl shift KP_UP", "selectPreviousExtendSelection",
1583                                "ctrl UP", "selectPreviousChangeLead",
1584                             "ctrl KP_UP", "selectPreviousChangeLead",
1585                           "DOWN", "selectNext",
1586                        "KP_DOWN", "selectNext",
1587                     "shift DOWN", "selectNextExtendSelection",
1588                  "shift KP_DOWN", "selectNextExtendSelection",
1589                        "ctrl shift DOWN", "selectNextExtendSelection",
1590                     "ctrl shift KP_DOWN", "selectNextExtendSelection",
1591                              "ctrl DOWN", "selectNextChangeLead",
1592                           "ctrl KP_DOWN", "selectNextChangeLead",
1593                          "RIGHT", "selectChild",
1594                       "KP_RIGHT", "selectChild",
1595                           "LEFT", "selectParent",
1596                        "KP_LEFT", "selectParent",
1597                        "PAGE_UP", "scrollUpChangeSelection",
1598                  "shift PAGE_UP", "scrollUpExtendSelection",
1599                     "ctrl shift PAGE_UP", "scrollUpExtendSelection",
1600                           "ctrl PAGE_UP", "scrollUpChangeLead",
1601                      "PAGE_DOWN", "scrollDownChangeSelection",
1602                "shift PAGE_DOWN", "scrollDownExtendSelection",
1603                   "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
1604                         "ctrl PAGE_DOWN", "scrollDownChangeLead",
1605                           "HOME", "selectFirst",
1606                     "shift HOME", "selectFirstExtendSelection",
1607                        "ctrl shift HOME", "selectFirstExtendSelection",
1608                              "ctrl HOME", "selectFirstChangeLead",
1609                            "END", "selectLast",
1610                      "shift END", "selectLastExtendSelection",
1611                         "ctrl shift END", "selectLastExtendSelection",
1612                               "ctrl END", "selectLastChangeLead",
1613                             "F2", "startEditing",
1614                         "ctrl A", "selectAll",
1615                     "ctrl SLASH", "selectAll",
1616                "ctrl BACK_SLASH", "clearSelection",
1617                      "ctrl LEFT", "scrollLeft",
1618                   "ctrl KP_LEFT", "scrollLeft",
1619                     "ctrl RIGHT", "scrollRight",
1620                  "ctrl KP_RIGHT", "scrollRight",
1621                                  "SPACE", "addToSelection",
1622                             "ctrl SPACE", "toggleAndAnchor",
1623                            "shift SPACE", "extendTo",
1624                       "ctrl shift SPACE", "moveSelectionTo"
1625         }),
1626        "Tree.focusInputMap.RightToLeft",
1627           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1628                          "RIGHT", "selectParent",
1629                       "KP_RIGHT", "selectParent",
1630                           "LEFT", "selectChild",
1631                        "KP_LEFT", "selectChild",
1632         }),
1633        "Tree.ancestorInputMap",
1634           new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1635             "ESCAPE", "cancel"
1636         }),
1637            // Bind specific keys that can invoke popup on currently
1638
// focused JComponent
1639
"RootPane.ancestorInputMap",
1640                new UIDefaults.LazyInputMap JavaDoc(new Object JavaDoc[] {
1641                     "shift F10", "postPopup",
1642                  }),
1643
1644        // These bindings are only enabled when there is a default
1645
// button set on the rootpane.
1646
"RootPane.defaultButtonWindowKeyBindings", new Object JavaDoc[] {
1647                     "ENTER", "press",
1648            "released ENTER", "release",
1649                "ctrl ENTER", "press",
1650           "ctrl released ENTER", "release"
1651          },
1652    };
1653
1654    table.putDefaults(defaults);
1655    }
1656
1657
1658    /**
1659     * Returns the ui that is of type <code>klass</code>, or null if
1660     * one can not be found.
1661     */

1662    static Object JavaDoc getUIOfType(ComponentUI ui, Class JavaDoc klass) {
1663        if (klass.isInstance(ui)) {
1664            return ui;
1665        }
1666        return null;
1667    }
1668
1669    // ********* Auditory Cue support methods and objects *********
1670
// also see the "AuditoryCues" section of the defaults table
1671

1672    /**
1673     * Returns an <code>ActionMap</code>.
1674     * <P>
1675     * This <code>ActionMap</code> contains <code>Actions</code> that
1676     * embody the ability to render an auditory cue. These auditory
1677     * cues map onto user and system activities that may be useful
1678     * for an end user to know about (such as a dialog box appearing).
1679     * <P>
1680     * At the appropriate time in a <code>JComponent</code> UI's lifecycle,
1681     * the ComponentUI is responsible for getting the appropriate
1682     * <code>Action</code> out of the <code>ActionMap</code> and passing
1683     * it on to <code>playSound</code>.
1684     * <P>
1685     * The <code>Actions</code> in this <code>ActionMap</code> are
1686     * created by the <code>createAudioAction</code> method.
1687     *
1688     * @return an ActionMap containing Actions
1689     * responsible for rendering auditory cues
1690     * @see #createAudioAction
1691     * @see #playSound(Action)
1692     * @since 1.4
1693     */

1694    protected ActionMap JavaDoc getAudioActionMap() {
1695    ActionMap JavaDoc audioActionMap = (ActionMap JavaDoc)UIManager.get(
1696                          "AuditoryCues.actionMap");
1697    if (audioActionMap == null) {
1698        Object JavaDoc[] acList = (Object JavaDoc[])UIManager.get("AuditoryCues.cueList");
1699        if (acList != null) {
1700        audioActionMap = new ActionMapUIResource();
1701        for(int counter = acList.length-1; counter >= 0; counter--) {
1702            audioActionMap.put(acList[counter],
1703                       createAudioAction(acList[counter]));
1704        }
1705        }
1706        UIManager.getLookAndFeelDefaults().put("AuditoryCues.actionMap",
1707                           audioActionMap);
1708    }
1709    return audioActionMap;
1710    }
1711
1712    /**
1713     * Returns an <code>Action</code>.
1714     * <P>
1715     * This Action contains the information and logic to render an
1716     * auditory cue. The <code>Object</code> that is passed to this
1717     * method contains the information needed to render the auditory
1718     * cue. Normally, this <code>Object</code> is a <code>String</code>
1719     * that points to an audio file relative to the current package.
1720     * This <code>Action</code>'s <code>actionPerformed</code> method
1721     * is fired by the <code>playSound</code> method.
1722     *
1723     * @return an Action which knows how to render the auditory
1724     * cue for one particular system or user activity
1725     * @see #playSound(Action)
1726     * @since 1.4
1727     */

1728    protected Action JavaDoc createAudioAction(Object JavaDoc key) {
1729    if (key != null) {
1730        String JavaDoc audioKey = (String JavaDoc)key;
1731        String JavaDoc audioValue = (String JavaDoc)UIManager.get(key);
1732        return new AudioAction(audioKey, audioValue);
1733    } else {
1734        return null;
1735    }
1736    }
1737
1738    /**
1739     * Pass the name String to the super constructor. This is used
1740     * later to identify the Action and decide whether to play it or
1741     * not. Store the resource String. I is used to get the audio
1742     * resource. In this case, the resource is an audio file.
1743     *
1744     * @since 1.4
1745     */

1746    private class AudioAction extends AbstractAction JavaDoc implements LineListener {
1747        // We strive to only play one sound at a time (other platforms
1748
// appear to do this). This is done by maintaining the field
1749
// clipPlaying. Every time a sound is to be played,
1750
// cancelCurrentSound is invoked to cancel any sound that may be
1751
// playing.
1752
private String JavaDoc audioResource;
1753    private byte[] audioBuffer;
1754
1755    /**
1756     * The String is the name of the Action and
1757     * points to the audio resource.
1758     * The byte[] is a buffer of the audio bits.
1759     */

1760    public AudioAction(String JavaDoc name, String JavaDoc resource) {
1761        super(name);
1762        audioResource = resource;
1763    }
1764
1765    public void actionPerformed(ActionEvent e) {
1766        if (audioBuffer == null) {
1767        audioBuffer = loadAudioData(audioResource);
1768        }
1769        if (audioBuffer != null) {
1770                cancelCurrentSound(null);
1771        try {
1772            AudioInputStream soundStream =
1773            AudioSystem.getAudioInputStream(
1774                new ByteArrayInputStream(audioBuffer));
1775            DataLine.Info info =
1776            new DataLine.Info(Clip.class, soundStream.getFormat());
1777            Clip clip = (Clip) AudioSystem.getLine(info);
1778            clip.open(soundStream);
1779                    clip.addLineListener(this);
1780
1781                    synchronized(audioLock) {
1782                        clipPlaying = clip;
1783                    }
1784
1785            clip.start();
1786        } catch (Exception JavaDoc ex) {}
1787        }
1788    }
1789
1790        public void update(LineEvent event) {
1791            if (event.getType() == LineEvent.Type.STOP) {
1792                cancelCurrentSound((Clip)event.getLine());
1793            }
1794        }
1795
1796        /**
1797         * If the parameter is null, or equal to the currently
1798         * playing sound, then cancel the currently playing sound.
1799         */

1800        private void cancelCurrentSound(Clip clip) {
1801            Clip lastClip = null;
1802
1803            synchronized(audioLock) {
1804                if (clip == null || clip == clipPlaying) {
1805                    lastClip = clipPlaying;
1806                    clipPlaying = null;
1807                }
1808            }
1809
1810            if (lastClip != null) {
1811                lastClip.removeLineListener(this);
1812                lastClip.close();
1813            }
1814        }
1815    }
1816
1817    /**
1818     * Utility method that loads audio bits for the specified
1819     * <code>soundFile</code> filename. If this method is unable to
1820     * build a viable path name from the <code>baseClass</code> and
1821     * <code>soundFile</code> passed into this method, it will
1822     * return <code>null</code>.
1823     *
1824     * @param baseClass used as the root class/location to get the
1825     * soundFile from
1826     * @param soundFile the name of the audio file to be retrieved
1827     * from disk
1828     * @return A byte[] with audio data or null
1829     * @since 1.4
1830     */

1831    private byte[] loadAudioData(final String JavaDoc soundFile){
1832    if (soundFile == null) {
1833        return null;
1834    }
1835    /* Copy resource into a byte array. This is
1836     * necessary because several browsers consider
1837     * Class.getResource a security risk since it
1838     * can be used to load additional classes.
1839     * Class.getResourceAsStream just returns raw
1840     * bytes, which we can convert to a sound.
1841     */

1842        byte[] buffer = (byte[])AccessController.doPrivileged(
1843                                                 new PrivilegedAction JavaDoc() {
1844        public Object JavaDoc run() {
1845            try {
1846            InputStream resource = BasicLookAndFeel.this.
1847                getClass().getResourceAsStream(soundFile);
1848            if (resource == null) {
1849                return null;
1850            }
1851            BufferedInputStream in =
1852                new BufferedInputStream(resource);
1853            ByteArrayOutputStream out =
1854                new ByteArrayOutputStream(1024);
1855            byte[] buffer = new byte[1024];
1856            int n;
1857            while ((n = in.read(buffer)) > 0) {
1858                out.write(buffer, 0, n);
1859            }
1860            in.close();
1861            out.flush();
1862            buffer = out.toByteArray();
1863                        return buffer;
1864            } catch (IOException ioe) {
1865            System.err.println(ioe.toString());
1866            return null;
1867            }
1868        }
1869        });
1870    if (buffer == null) {
1871        System.err.println(getClass().getName() + "/" +
1872                   soundFile + " not found.");
1873        return null;
1874    }
1875    if (buffer.length == 0) {
1876        System.err.println("warning: " + soundFile +
1877                   " is zero-length");
1878        return null;
1879    }
1880    return buffer;
1881    }
1882
1883    /**
1884     * Decides whether to fire the <code>Action</code> that is passed into
1885     * it and, if needed, fires the <code>Action</code>'s
1886     * <code>actionPerformed</code> method. This has the effect
1887     * of rendering the audio appropriate for the situation.
1888     * <P>
1889     * The set of possible cues to be played are stored in the default
1890     * table value "AuditoryCues.cueList". The cues that will be played
1891     * are stored in "AuditoryCues.playList".
1892     *
1893     * @param audioAction an Action that knows how to render the audio
1894     * associated with the system or user activity
1895     * that is occurring
1896     * @since 1.4
1897     */

1898    protected void playSound(Action JavaDoc audioAction) {
1899    if (audioAction != null) {
1900        Object JavaDoc[] audioStrings = (Object JavaDoc[])
1901                            UIManager.get("AuditoryCues.playList");
1902        if (audioStrings != null) {
1903        // create a HashSet to help us decide to play or not
1904
HashSet audioCues = new HashSet();
1905        for (int i = 0; i < audioStrings.length; i++) {
1906            audioCues.add(audioStrings[i]);
1907        }
1908        // get the name of the Action
1909
String JavaDoc actionName = (String JavaDoc)audioAction.getValue(Action.NAME);
1910        // if the actionName is in the audioCues HashSet, play it.
1911
if (audioCues.contains(actionName)) {
1912            audioAction.actionPerformed(new
1913            ActionEvent(this, ActionEvent.ACTION_PERFORMED,
1914                    actionName));
1915        }
1916        }
1917    }
1918    }
1919
1920
1921    /**
1922     * Sets the parent of the passed in ActionMap to be the audio action
1923     * map.
1924     */

1925    static void installAudioActionMap(ActionMap JavaDoc map) {
1926    LookAndFeel JavaDoc laf = UIManager.getLookAndFeel();
1927        if (laf instanceof BasicLookAndFeel JavaDoc) {
1928            map.setParent(((BasicLookAndFeel JavaDoc)laf).getAudioActionMap());
1929        }
1930    }
1931
1932
1933    /**
1934     * Helper method to play a named sound.
1935     *
1936     * @param c JComponent to play the sound for.
1937     * @param actionKey Key for the sound.
1938     */

1939    static void playSound(JComponent JavaDoc c, Object JavaDoc actionKey) {
1940        LookAndFeel JavaDoc laf = UIManager.getLookAndFeel();
1941        if (laf instanceof BasicLookAndFeel JavaDoc) {
1942            ActionMap JavaDoc map = c.getActionMap();
1943            if (map != null) {
1944                Action JavaDoc audioAction = map.get(actionKey);
1945                if (audioAction != null) {
1946                    // pass off firing the Action to a utility method
1947
((BasicLookAndFeel JavaDoc)laf).playSound(audioAction);
1948                }
1949            }
1950        }
1951    }
1952
1953
1954    // At this point we need this method here. But we assume that there
1955
// will be a common method for this purpose in the future releases.
1956
static Component JavaDoc compositeRequestFocus(Component JavaDoc component) {
1957    if (component instanceof Container JavaDoc) {
1958        Container JavaDoc container = (Container JavaDoc)component;
1959        if (container.isFocusCycleRoot()) {
1960        FocusTraversalPolicy JavaDoc policy = container.getFocusTraversalPolicy();
1961        Component JavaDoc comp = policy.getDefaultComponent(container);
1962        if (comp!=null) {
1963            comp.requestFocus();
1964            return comp;
1965        }
1966        }
1967        Container JavaDoc rootAncestor = container.getFocusCycleRootAncestor();
1968        if (rootAncestor!=null) {
1969        FocusTraversalPolicy JavaDoc policy = rootAncestor.getFocusTraversalPolicy();
1970        Component JavaDoc comp = policy.getComponentAfter(rootAncestor, container);
1971        
1972        if (comp!=null && SwingUtilities.isDescendingFrom(comp, container)) {
1973            comp.requestFocus();
1974            return comp;
1975        }
1976        }
1977    }
1978        if (component.isFocusable()) {
1979        component.requestFocus();
1980            return component;
1981        }
1982        return null;
1983    }
1984
1985    /**
1986     * This is invoked from BasicPopupUI when an instance of BasicPopupUI
1987     * is created. This gives us an opportunity to register Popup specific
1988     * listeners.
1989     */

1990    void createdPopup() {
1991        if (invocator == null) {
1992            invocator = new PopupInvocationHelper();
1993            hasPopups = true;
1994
1995            // Add a PropertyChangeListener to our AppContext so we're alerted
1996
// when the AppContext is disposed(), at which time this laf should
1997
// be uninitialize()d.
1998
disposer = new PropertyChangeListener JavaDoc() {
1999                public void propertyChange(PropertyChangeEvent JavaDoc prpChg) {
2000                    uninitialize();
2001                }
2002            };
2003            AppContext.getAppContext().addPropertyChangeListener(
2004                                                        AppContext.GUI_DISPOSED,
2005                                                        disposer);
2006        }
2007    }
2008
2009    /**
2010     * This class contains listener that watches for all the mouse
2011     * events that can possibly invoke popup on the component
2012     */

2013    class PopupInvocationHelper implements AWTEventListener,PrivilegedAction JavaDoc {
2014        PopupInvocationHelper() {
2015            super();
2016            AccessController.doPrivileged(this);
2017        }
2018
2019        public Object JavaDoc run() {
2020            Toolkit JavaDoc tk = Toolkit.getDefaultToolkit();
2021            if(invocator == null) {
2022                tk.addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK);
2023            } else {
2024                tk.removeAWTEventListener(invocator);
2025            }
2026            // Return value not used.
2027
return null;
2028        }
2029
2030        public void eventDispatched(AWTEvent JavaDoc ev) {
2031            if((ev.getID() & AWTEvent.MOUSE_EVENT_MASK) != 0) {
2032                MouseEvent me = (MouseEvent) ev;
2033                if(me.isPopupTrigger()) {
2034                    MenuElement JavaDoc[] elems = MenuSelectionManager
2035                            .defaultManager()
2036                            .getSelectedPath();
2037                    if(elems != null && elems.length != 0) {
2038                        return;
2039                        // We shall not interfere with already opened menu
2040
}
2041                    Object JavaDoc c = me.getSource();
2042                    if(c instanceof JComponent JavaDoc) {
2043                        JComponent JavaDoc src = (JComponent JavaDoc) c;
2044                        if(src.getComponentPopupMenu() != null) {
2045                            Point JavaDoc pt = src.getPopupLocation(me);
2046                            if(pt == null) {
2047                                pt = me.getPoint();
2048                            }
2049                            src.getComponentPopupMenu().show(src, pt.x, pt.y);
2050                            me.consume();
2051                        }
2052                    }
2053                }
2054            }
2055        }
2056    }
2057}
2058
Popular Tags