1 /*
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package javax.swing.plaf.basic;
27
28 import java.awt.Font;
29 import java.awt.Color;
30 import java.awt.SystemColor;
31 import java.awt.event;
32 import java.awt.Insets;
33 import java.awt.Component;
34 import java.awt.Container;
35 import java.awt.FocusTraversalPolicy;
36 import java.awt.AWTEvent;
37 import java.awt.Toolkit;
38 import java.awt.Point;
39 import java.net.URL;
40 import java.io;
41 import java.awt.Dimension;
42 import java.awt.KeyboardFocusManager;
43 import java.security.AccessController;
44 import java.security.PrivilegedAction;
45 import java.util;
46 import java.lang.reflect;
47 import javax.sound.sampled;
48
49 import sun.awt.AppContext;
50
51 import sun.swing.SwingLazyValue;
52 import sun.swing.SwingUtilities2;
53
54 import javax.swing.LookAndFeel;
55 import javax.swing.AbstractAction;
56 import javax.swing.Action;
57 import javax.swing.ActionMap;
58 import javax.swing.BorderFactory;
59 import javax.swing.JComponent;
60 import javax.swing.ImageIcon;
61 import javax.swing.UIDefaults;
62 import javax.swing.UIManager;
63 import javax.swing.KeyStroke;
64 import javax.swing.JTextField;
65 import javax.swing.DefaultListCellRenderer;
66 import javax.swing.FocusManager;
67 import javax.swing.LayoutFocusTraversalPolicy;
68 import javax.swing.SwingUtilities;
69 import javax.swing.MenuSelectionManager;
70 import javax.swing.MenuElement;
71 import javax.swing.border;
72 import javax.swing.plaf;
73 import javax.swing.text.JTextComponent;
74 import javax.swing.text.DefaultEditorKit;
75 import javax.swing.JInternalFrame;
76 import java.beans.PropertyVetoException;
77 import java.awt.Window;
78 import java.beans.PropertyChangeListener;
79 import java.beans.PropertyChangeEvent;
80
81
82 /**
83 * A base class to use in creating a look and feel for Swing.
84 * <p>
85 * Each of the {@code ComponentUI}s provided by {@code
86 * BasicLookAndFeel} derives its behavior from the defaults
87 * table. Unless otherwise noted each of the {@code ComponentUI}
88 * implementations in this package document the set of defaults they
89 * use. Unless otherwise noted the defaults are installed at the time
90 * {@code installUI} is invoked, and follow the recommendations
91 * outlined in {@code LookAndFeel} for installing defaults.
92 * <p>
93 * <strong>Warning:</strong>
94 * Serialized objects of this class will not be compatible with
95 * future Swing releases. The current serialization support is
96 * appropriate for short term storage or RMI between applications running
97 * the same version of Swing. As of 1.4, support for long term storage
98 * of all JavaBeans<sup><font size="-2">TM</font></sup>
99 * has been added to the <code>java.beans</code> package.
100 * Please see {@link java.beans.XMLEncoder}.
101 *
102 * @author unattributed
103 */
104 public abstract class BasicLookAndFeel extends LookAndFeel implements Serializable
105 {
106 /**
107 * Whether or not the developer has created a JPopupMenu.
108 */
109 static boolean needsEventHelper;
110
111 /**
112 * Lock used when manipulating clipPlaying.
113 */
114 private transient Object audioLock = new Object();
115 /**
116 * The Clip that is currently playing (set in AudioAction).
117 */
118 private Clip clipPlaying;
119
120 AWTEventHelper invocator = null;
121
122 /*
123 * Listen for our AppContext being disposed
124 */
125 private PropertyChangeListener disposer = null;
126
127 /**
128 * Returns the look and feel defaults. The returned {@code UIDefaults}
129 * is populated by invoking, in order, {@code initClassDefaults},
130 * {@code initSystemColorDefaults} and {@code initComponentDefaults}.
131 * <p>
132 * While this method is public, it should only be invoked by the
133 * {@code UIManager} when the look and feel is set as the current
134 * look and feel and after {@code initialize} has been invoked.
135 *
136 * @return the look and feel defaults
137 *
138 * @see #initClassDefaults
139 * @see #initSystemColorDefaults
140 * @see #initComponentDefaults
141 */
142 public UIDefaults getDefaults() {
143 UIDefaults table = new UIDefaults(610, 0.75f);
144
145 initClassDefaults(table);
146 initSystemColorDefaults(table);
147 initComponentDefaults(table);
148
149 return table;
150 }
151
152 /**
153 * {@inheritDoc}
154 */
155 public void initialize() {
156 if (needsEventHelper) {
157 installAWTEventListener();
158 }
159 }
160
161 void installAWTEventListener() {
162 if (invocator == null) {
163 invocator = new AWTEventHelper();
164 needsEventHelper = true;
165
166 // Add a PropertyChangeListener to our AppContext so we're alerted
167 // when the AppContext is disposed(), at which time this laf should
168 // be uninitialize()d.
169 disposer = new PropertyChangeListener() {
170 public void propertyChange(PropertyChangeEvent prpChg) {
171 uninitialize();
172 }
173 };
174 AppContext.getAppContext().addPropertyChangeListener(
175 AppContext.GUI_DISPOSED,
176 disposer);
177 }
178 }
179
180 /**
181 * {@inheritDoc}
182 */
183 public void uninitialize() {
184 AppContext context = AppContext.getAppContext();
185 synchronized (BasicPopupMenuUI.MOUSE_GRABBER_KEY) {
186 Object grabber = context.get(BasicPopupMenuUI.MOUSE_GRABBER_KEY);
187 if (grabber != null) {
188 ((BasicPopupMenuUI.MouseGrabber)grabber).uninstall();
189 }
190 }
191 synchronized (BasicPopupMenuUI.MENU_KEYBOARD_HELPER_KEY) {
192 Object helper =
193 context.get(BasicPopupMenuUI.MENU_KEYBOARD_HELPER_KEY);
194 if (helper != null) {
195 ((BasicPopupMenuUI.MenuKeyboardHelper)helper).uninstall();
196 }
197 }
198
199 if(invocator != null) {
200 AccessController.doPrivileged(invocator);
201 invocator = null;
202 }
203
204 if (disposer != null) {
205 // Note that we're likely calling removePropertyChangeListener()
206 // during the course of AppContext.firePropertyChange().
207 // However, EventListenerAggreggate has code to safely modify
208 // the list under such circumstances.
209 context.removePropertyChangeListener(AppContext.GUI_DISPOSED,
210 disposer);
211 disposer = null;
212 }
213 }
214
215 /**
216 * Populates {@code table} with mappings from {@code uiClassID} to the
217 * fully qualified name of the ui class. The value for a
218 * particular {@code uiClassID} is {@code
219 * "javax.swing.plaf.basic.Basic + uiClassID"}. For example, the
220 * value for the {@code uiClassID} {@code TreeUI} is {@code
221 * "javax.swing.plaf.basic.BasicTreeUI"}.
222 *
223 * @param table the {@code UIDefaults} instance the entries are
224 * added to
225 * @throws NullPointerException if {@code table} is {@code null}
226 *
227 * @see javax.swing.LookAndFeel
228 * @see #getDefaults
229 */
230 protected void initClassDefaults(UIDefaults table)
231 {
232 final String basicPackageName = "javax.swing.plaf.basic.";
233 Object[] uiDefaults = {
234 "ButtonUI", basicPackageName + "BasicButtonUI",
235 "CheckBoxUI", basicPackageName + "BasicCheckBoxUI",
236 "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
237 "FormattedTextFieldUI", basicPackageName + "BasicFormattedTextFieldUI",
238 "MenuBarUI", basicPackageName + "BasicMenuBarUI",
239 "MenuUI", basicPackageName + "BasicMenuUI",
240 "MenuItemUI", basicPackageName + "BasicMenuItemUI",
241 "CheckBoxMenuItemUI", basicPackageName + "BasicCheckBoxMenuItemUI",
242 "RadioButtonMenuItemUI", basicPackageName + "BasicRadioButtonMenuItemUI",
243 "RadioButtonUI", basicPackageName + "BasicRadioButtonUI",
244 "ToggleButtonUI", basicPackageName + "BasicToggleButtonUI",
245 "PopupMenuUI", basicPackageName + "BasicPopupMenuUI",
246 "ProgressBarUI", basicPackageName + "BasicProgressBarUI",
247 "ScrollBarUI", basicPackageName + "BasicScrollBarUI",
248 "ScrollPaneUI", basicPackageName + "BasicScrollPaneUI",
249 "SplitPaneUI", basicPackageName + "BasicSplitPaneUI",
250 "SliderUI", basicPackageName + "BasicSliderUI",
251 "SeparatorUI", basicPackageName + "BasicSeparatorUI",
252 "SpinnerUI", basicPackageName + "BasicSpinnerUI",
253 "ToolBarSeparatorUI", basicPackageName + "BasicToolBarSeparatorUI",
254 "PopupMenuSeparatorUI", basicPackageName + "BasicPopupMenuSeparatorUI",
255 "TabbedPaneUI", basicPackageName + "BasicTabbedPaneUI",
256 "TextAreaUI", basicPackageName + "BasicTextAreaUI",
257 "TextFieldUI", basicPackageName + "BasicTextFieldUI",
258 "PasswordFieldUI", basicPackageName + "BasicPasswordFieldUI",
259 "TextPaneUI", basicPackageName + "BasicTextPaneUI",
260 "EditorPaneUI", basicPackageName + "BasicEditorPaneUI",
261 "TreeUI", basicPackageName + "BasicTreeUI",
262 "LabelUI", basicPackageName + "BasicLabelUI",
263 "ListUI", basicPackageName + "BasicListUI",
264 "ToolBarUI", basicPackageName + "BasicToolBarUI",
265 "ToolTipUI", basicPackageName + "BasicToolTipUI",
266 "ComboBoxUI", basicPackageName + "BasicComboBoxUI",
267 "TableUI", basicPackageName + "BasicTableUI",
268 "TableHeaderUI", basicPackageName + "BasicTableHeaderUI",
269 "InternalFrameUI", basicPackageName + "BasicInternalFrameUI",
270 "DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI",
271 "DesktopIconUI", basicPackageName + "BasicDesktopIconUI",
272 "OptionPaneUI", basicPackageName + "BasicOptionPaneUI",
273 "PanelUI", basicPackageName + "BasicPanelUI",
274 "ViewportUI", basicPackageName + "BasicViewportUI",
275 "RootPaneUI", basicPackageName + "BasicRootPaneUI",
276 };
277
278 table.putDefaults(uiDefaults);
279 }
280
281 /**
282 * Populates {@code table} with system colors. This creates an
283 * array of {@code name-color} pairs and invokes {@code
284 * loadSystemColors}.
285 * <p>
286 * The name is a {@code String} that corresponds to the name of
287 * one of the static {@code SystemColor} fields in the {@code
288 * SystemColor} class. A name-color pair is created for every
289 * such {@code SystemColor} field.
290 * <p>
291 * The {@code color} corresponds to a hex {@code String} as
292 * understood by {@code Color.decode}. For example, one of the
293 * {@code name-color} pairs is {@code
294 * "desktop"-"#005C5C"}. This corresponds to the {@code
295 * SystemColor} field {@code desktop}, with a color value of
296 * {@code new Color(0x005C5C)}.
297 * <p>
298 * The following shows two of the {@code name-color} pairs:
299 * <pre>
300 * String[] nameColorPairs = new String[] {
301 * "desktop", "#005C5C",
302 * "activeCaption", "#000080" };
303 * loadSystemColors(table, nameColorPairs, isNativeLookAndFeel());
304 * </pre>
305 *
306 * As previously stated, this invokes {@code loadSystemColors}
307 * with the supplied {@code table} and {@code name-color} pair
308 * array. The last argument to {@code loadSystemColors} indicates
309 * whether the value of the field in {@code SystemColor} should be
310 * used. This method passes the value of {@code
311 * isNativeLookAndFeel()} as the last argument to {@code loadSystemColors}.
312 *
313 * @param table the {@code UIDefaults} object the values are added to
314 * @throws NullPointerException if {@code table} is {@code null}
315 *
316 * @see java.awt.SystemColor
317 * @see #getDefaults
318 * @see #loadSystemColors
319 */
320 protected void initSystemColorDefaults(UIDefaults table)
321 {
322 String[] defaultSystemColors = {
323 "desktop", "#005C5C", /* Color of the desktop background */
324 "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
325 "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
326 "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
327 "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
328 "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
329 "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
330 "window", "#FFFFFF", /* Default color for the interior of windows */
331 "windowBorder", "#000000", /* ??? */
332 "windowText", "#000000", /* ??? */
333 "menu", "#C0C0C0", /* Background color for menus */
334 "menuText", "#000000", /* Text color for menus */
335 "text", "#C0C0C0", /* Text background color */
336 "textText", "#000000", /* Text foreground color */
337 "textHighlight", "#000080", /* Text background color when selected */
338 "textHighlightText", "#FFFFFF", /* Text color when selected */
339 "textInactiveText", "#808080", /* Text color when disabled */
340 "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
341 "controlText", "#000000", /* Default color for text in controls */
342 "controlHighlight", "#C0C0C0", /* Specular highlight (opposite of the shadow) */
343 "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
344 "controlShadow", "#808080", /* Shadow color for controls */
345 "controlDkShadow", "#000000", /* Dark shadow color for controls */
346 "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
347 "info", "#FFFFE1", /* ??? */
348 "infoText", "#000000" /* ??? */
349 };
350
351 loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());
352 }
353
354
355 /**
356 * Populates {@code table} with the {@code name-color} pairs in
357 * {@code systemColors}. Refer to
358 * {@link #initSystemColorDefaults(UIDefaults)} for details on
359 * the format of {@code systemColors}.
360 * <p>
361 * An entry is added to {@code table} for each of the {@code name-color}
362 * pairs in {@code systemColors}. The entry key is
363 * the {@code name} of the {@code name-color} pair.
364 * <p>
365 * The value of the entry corresponds to the {@code color} of the
366 * {@code name-color} pair. The value of the entry is calculated
367 * in one of two ways. With either approach the value is always a
368 * {@code ColorUIResource}.
369 * <p>
370 * If {@code useNative} is {@code false}, the {@code color} is
371 * created by using {@code Color.decode} to convert the {@code
372 * String} into a {@code Color}. If {@code decode} can not convert
373 * the {@code String} into a {@code Color} ({@code
374 * NumberFormatException} is thrown) then a {@code
375 * ColorUIResource} of black is used.
376 * <p>
377 * If {@code useNative} is {@code true}, the {@code color} is the
378 * value of the field in {@code SystemColor} with the same name as
379 * the {@code name} of the {@code name-color} pair. If the field
380 * is not valid, a {@code ColorUIResource} of black is used.
381 *
382 * @param table the {@code UIDefaults} object the values are added to
383 * @param systemColors array of {@code name-color} pairs as described
384 * in {@link #initSystemColorDefaults(UIDefaults)}
385 * @param useNative whether the color is obtained from {@code SystemColor}
386 * or {@code Color.decode}
387 * @throws NullPointerException if {@code systemColors} is {@code null}; or
388 * {@code systemColors} is not empty, and {@code table} is
389 * {@code null}; or one of the
390 * names of the {@code name-color} pairs is {@code null}; or
391 * {@code useNative} is {@code false} and one of the
392 * {@code colors} of the {@code name-color} pairs is {@code null}
393 * @throws ArrayIndexOutOfBoundsException if {@code useNative} is
394 * {@code false} and {@code systemColors.length} is odd
395 *
396 * @see #initSystemColorDefaults(javax.swing.UIDefaults)
397 * @see java.awt.SystemColor
398 * @see java.awt.Color#decode(String)
399 */
400 protected void loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative)
401 {
402 /* PENDING(hmuller) We don't load the system colors below because
403 * they're not reliable. Hopefully we'll be able to do better in
404 * a future version of AWT.
405 */
406 if (useNative) {
407 for(int i = 0; i < systemColors.length; i += 2) {
408 Color color = Color.black;
409 try {
410 String name = systemColors[i];
411 color = (Color)(SystemColor.class.getField(name).get(null));
412 } catch (Exception e) {
413 }
414 table.put(systemColors[i], new ColorUIResource(color));
415 }
416 } else {
417 for(int i = 0; i < systemColors.length; i += 2) {
418 Color color = Color.black;
419 try {
420 color = Color.decode(systemColors[i + 1]);
421 }
422 catch(NumberFormatException e) {
423 e.printStackTrace();
424 }
425 table.put(systemColors[i], new ColorUIResource(color));
426 }
427 }
428 }
429 /**
430 * Initialize the defaults table with the name of the ResourceBundle
431 * used for getting localized defaults. Also initialize the default
432 * locale used when no locale is passed into UIDefaults.get(). The
433 * default locale should generally not be relied upon. It is here for
434 * compatability with releases prior to 1.4.
435 */
436 private void initResourceBundle(UIDefaults table) {
437 table.setDefaultLocale( Locale.getDefault() );
438 table.addResourceBundle( "com.sun.swing.internal.plaf.basic.resources.basic" );
439 }
440
441 /**
442 * Populates {@code table} with the defaults for the basic look and
443 * feel.
444 *
445 * @param table the {@code UIDefaults} to add the values to
446 * @throws NullPointerException if {@code table} is {@code null}
447 */
448 protected void initComponentDefaults(UIDefaults table)
449 {
450
451 initResourceBundle(table);
452
453 // *** Shared Integers
454 Integer fiveHundred = new Integer(500);
455
456 // *** Shared Longs
457 Long oneThousand = new Long(1000);
458
459 // *** Shared Fonts
460 Integer twelve = new Integer(12);
461 Integer fontPlain = new Integer(Font.PLAIN);
462 Integer fontBold = new Integer(Font.BOLD);
463 Object dialogPlain12 = new SwingLazyValue(
464 "javax.swing.plaf.FontUIResource",
465 null,
466 new Object[] {Font.DIALOG, fontPlain, twelve});
467 Object serifPlain12 = new SwingLazyValue(
468 "javax.swing.plaf.FontUIResource",
469 null,
470 new Object[] {Font.SERIF, fontPlain, twelve});
471 Object sansSerifPlain12 = new SwingLazyValue(
472 "javax.swing.plaf.FontUIResource",
473 null,
474 new Object[] {Font.SANS_SERIF, fontPlain, twelve});
475 Object monospacedPlain12 = new SwingLazyValue(
476 "javax.swing.plaf.FontUIResource",
477 null,
478 new Object[] {Font.MONOSPACED, fontPlain, twelve});
479 Object dialogBold12 = new SwingLazyValue(
480 "javax.swing.plaf.FontUIResource",
481 null,
482 new Object[] {Font.DIALOG, fontBold, twelve});
483
484
485 // *** Shared Colors
486 ColorUIResource red = new ColorUIResource(Color.red);
487 ColorUIResource black = new ColorUIResource(Color.black);
488 ColorUIResource white = new ColorUIResource(Color.white);
489 ColorUIResource yellow = new ColorUIResource(Color.yellow);
490 ColorUIResource gray = new ColorUIResource(Color.gray);
491 ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
492 ColorUIResource darkGray = new ColorUIResource(Color.darkGray);
493 ColorUIResource scrollBarTrack = new ColorUIResource(224, 224, 224);
494
495 Color control = table.getColor("control");
496 Color controlDkShadow = table.getColor("controlDkShadow");
497 Color controlHighlight = table.getColor("controlHighlight");
498 Color controlLtHighlight = table.getColor("controlLtHighlight");
499 Color controlShadow = table.getColor("controlShadow");
500 Color controlText = table.getColor("controlText");
501 Color menu = table.getColor("menu");
502 Color menuText = table.getColor("menuText");
503 Color textHighlight = table.getColor("textHighlight");
504 Color textHighlightText = table.getColor("textHighlightText");
505 Color textInactiveText = table.getColor("textInactiveText");
506 Color textText = table.getColor("textText");
507 Color window = table.getColor("window");
508
509 // *** Shared Insets
510 InsetsUIResource zeroInsets = new InsetsUIResource(0,0,0,0);
511 InsetsUIResource twoInsets = new InsetsUIResource(2,2,2,2);
512 InsetsUIResource threeInsets = new InsetsUIResource(3,3,3,3);
513
514 // *** Shared Borders
515 Object marginBorder = new SwingLazyValue(
516 "javax.swing.plaf.basic.BasicBorders$MarginBorder");
517 Object etchedBorder = new SwingLazyValue(
518 "javax.swing.plaf.BorderUIResource",
519 "getEtchedBorderUIResource");
520 Object loweredBevelBorder = new SwingLazyValue(
521 "javax.swing.plaf.BorderUIResource",
522 "getLoweredBevelBorderUIResource");
523
524 Object popupMenuBorder = new SwingLazyValue(
525 "javax.swing.plaf.basic.BasicBorders",
526 "getInternalFrameBorder");
527
528 Object blackLineBorder = new SwingLazyValue(
529 "javax.swing.plaf.BorderUIResource",
530 "getBlackLineBorderUIResource");
531 Object focusCellHighlightBorder = new SwingLazyValue(
532 "javax.swing.plaf.BorderUIResource$LineBorderUIResource",
533 null,
534 new Object[] {yellow});
535
536 Object noFocusBorder = new BorderUIResource.EmptyBorderUIResource(1,1,1,1);
537
538 Object tableHeaderBorder = new SwingLazyValue(
539 "javax.swing.plaf.BorderUIResource$BevelBorderUIResource",
540 null,
541 new Object[] { new Integer(BevelBorder.RAISED),
542 controlLtHighlight,
543 control,
544 controlDkShadow,
545 controlShadow });
546
547
548 // *** Button value objects
549
550 Object buttonBorder =
551 new SwingLazyValue(
552 "javax.swing.plaf.basic.BasicBorders",
553 "getButtonBorder");
554
555 Object buttonToggleBorder =
556 new SwingLazyValue(
557 "javax.swing.plaf.basic.BasicBorders",
558 "getToggleButtonBorder");
559
560 Object radioButtonBorder =
561 new SwingLazyValue(
562 "javax.swing.plaf.basic.BasicBorders",
563 "getRadioButtonBorder");
564
565 // *** FileChooser / FileView value objects
566
567 Object newFolderIcon = SwingUtilities2.makeIcon(getClass(),
568 BasicLookAndFeel.class,
569 "icons/NewFolder.gif");
570 Object upFolderIcon = SwingUtilities2.makeIcon(getClass(),
571 BasicLookAndFeel.class,
572 "icons/UpFolder.gif");
573 Object homeFolderIcon = SwingUtilities2.makeIcon(getClass(),
574 BasicLookAndFeel.class,
575 "icons/HomeFolder.gif");
576 Object detailsViewIcon = SwingUtilities2.makeIcon(getClass(),
577 BasicLookAndFeel.class,
578 "icons/DetailsView.gif");
579 Object listViewIcon = SwingUtilities2.makeIcon(getClass(),
580 BasicLookAndFeel.class,
581 "icons/ListView.gif");
582 Object directoryIcon = SwingUtilities2.makeIcon(getClass(),
583 BasicLookAndFeel.class,
584 "icons/Directory.gif");
585 Object fileIcon = SwingUtilities2.makeIcon(getClass(),
586 BasicLookAndFeel.class,
587 "icons/File.gif");
588 Object computerIcon = SwingUtilities2.makeIcon(getClass(),
589 BasicLookAndFeel.class,
590 "icons/Computer.gif");
591 Object hardDriveIcon = SwingUtilities2.makeIcon(getClass(),
592 BasicLookAndFeel.class,
593 "icons/HardDrive.gif");
594 Object floppyDriveIcon = SwingUtilities2.makeIcon(getClass(),
595 BasicLookAndFeel.class,
596 "icons/FloppyDrive.gif");
597
598
599 // *** InternalFrame value objects
600
601 Object internalFrameBorder = new SwingLazyValue(
602 "javax.swing.plaf.basic.BasicBorders",
603 "getInternalFrameBorder");
604
605 // *** List value objects
606
607 Object listCellRendererActiveValue = new UIDefaults.ActiveValue() {
608 public Object createValue(UIDefaults table) {
609 return new DefaultListCellRenderer.UIResource();
610 }
611 };
612
613
614 // *** Menus value objects
615
616 Object menuBarBorder =
617 new SwingLazyValue(
618 "javax.swing.plaf.basic.BasicBorders",
619 "getMenuBarBorder");
620
621 Object menuItemCheckIcon =
622 new SwingLazyValue(
623 "javax.swing.plaf.basic.BasicIconFactory",
624 "getMenuItemCheckIcon");
625
626 Object menuItemArrowIcon =
627 new SwingLazyValue(
628 "javax.swing.plaf.basic.BasicIconFactory",
629 "getMenuItemArrowIcon");
630
631
632 Object menuArrowIcon =
633 new SwingLazyValue(
634 "javax.swing.plaf.basic.BasicIconFactory",
635 "getMenuArrowIcon");
636
637 Object checkBoxIcon =
638 new SwingLazyValue(
639 "javax.swing.plaf.basic.BasicIconFactory",
640 "getCheckBoxIcon");
641
642 Object radioButtonIcon =
643 new SwingLazyValue(
644 "javax.swing.plaf.basic.BasicIconFactory",
645 "getRadioButtonIcon");
646
647 Object checkBoxMenuItemIcon =
648 new SwingLazyValue(
649 "javax.swing.plaf.basic.BasicIconFactory",
650 "getCheckBoxMenuItemIcon");
651
652 Object radioButtonMenuItemIcon =
653 new SwingLazyValue(
654 "javax.swing.plaf.basic.BasicIconFactory",
655 "getRadioButtonMenuItemIcon");
656
657 Object menuItemAcceleratorDelimiter = "+";
658
659 // *** OptionPane value objects
660
661 Object optionPaneMinimumSize = new DimensionUIResource(262, 90);
662
663 Integer zero = new Integer(0);
664 Object zeroBorder = new SwingLazyValue(
665 "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
666 new Object[] {zero, zero, zero, zero});
667
668 Integer ten = new Integer(10);
669 Object optionPaneBorder = new SwingLazyValue(
670 "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
671 new Object[] {ten, ten, twelve, ten});
672
673 Object optionPaneButtonAreaBorder = new SwingLazyValue(
674 "javax.swing.plaf.BorderUIResource$EmptyBorderUIResource",
675 new Object[] {new Integer(6), zero, zero, zero});
676
677
678 // *** ProgessBar value objects
679
680 Object progressBarBorder =
681 new SwingLazyValue(
682 "javax.swing.plaf.basic.BasicBorders",
683 "getProgressBarBorder");
684
685 // ** ScrollBar value objects
686
687 Object minimumThumbSize = new DimensionUIResource(8,8);
688 Object maximumThumbSize = new DimensionUIResource(4096,4096);
689
690 // ** Slider value objects
691
692 Object sliderFocusInsets = twoInsets;
693
694 Object toolBarSeparatorSize = new DimensionUIResource( 10, 10 );
695
696
697 // *** SplitPane value objects
698
699 Object splitPaneBorder =
700 new SwingLazyValue(
701 "javax.swing.plaf.basic.BasicBorders",
702 "getSplitPaneBorder");
703 Object splitPaneDividerBorder =
704 new SwingLazyValue(
705 "javax.swing.plaf.basic.BasicBorders",
706 "getSplitPaneDividerBorder");
707
708 // ** TabbedBane value objects
709
710 Object tabbedPaneTabInsets = new InsetsUIResource(0, 4, 1, 4);
711
712 Object tabbedPaneTabPadInsets = new InsetsUIResource(2, 2, 2, 1);
713
714 Object tabbedPaneTabAreaInsets = new InsetsUIResource(3, 2, 0, 2);
715
716 Object tabbedPaneContentBorderInsets = new InsetsUIResource(2, 2, 3, 3);
717
718
719 // *** Text value objects
720
721 Object textFieldBorder =
722 new SwingLazyValue(
723 "javax.swing.plaf.basic.BasicBorders",
724 "getTextFieldBorder");
725
726 Object editorMargin = threeInsets;
727
728 Object caretBlinkRate = fiveHundred;
729 Integer four = new Integer(4);
730
731 Object[] allAuditoryCues = new Object[] {
732 "CheckBoxMenuItem.commandSound",
733 "InternalFrame.closeSound",
734 "InternalFrame.maximizeSound",
735 "InternalFrame.minimizeSound",
736 "InternalFrame.restoreDownSound",
737 "InternalFrame.restoreUpSound",
738 "MenuItem.commandSound",
739 "OptionPane.errorSound",
740 "OptionPane.informationSound",
741 "OptionPane.questionSound",
742 "OptionPane.warningSound",
743 "PopupMenu.popupSound",
744 "RadioButtonMenuItem.commandSound"};
745
746 Object[] noAuditoryCues = new Object[] {"mute"};
747
748 // *** Component Defaults
749
750 Object[] defaults = {
751 // *** Auditory Feedback
752 "AuditoryCues.cueList", allAuditoryCues,
753 "AuditoryCues.allAuditoryCues", allAuditoryCues,
754 "AuditoryCues.noAuditoryCues", noAuditoryCues,
755 // this key defines which of the various cues to render.
756 // L&Fs that want auditory feedback NEED to override playList.
757 "AuditoryCues.playList", null,
758
759 // *** Buttons
760 "Button.defaultButtonFollowsFocus", Boolean.TRUE,
761 "Button.font", dialogPlain12,
762 "Button.background", control,
763 "Button.foreground", controlText,
764 "Button.shadow", controlShadow,
765 "Button.darkShadow", controlDkShadow,
766 "Button.light", controlHighlight,
767 "Button.highlight", controlLtHighlight,
768 "Button.border", buttonBorder,
769 "Button.margin", new InsetsUIResource(2, 14, 2, 14),
770 "Button.textIconGap", four,
771 "Button.textShiftOffset", zero,
772 "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
773 "SPACE", "pressed",
774 "released SPACE", "released",
775 "ENTER", "pressed",
776 "released ENTER", "released"
777 }),
778
779 "ToggleButton.font", dialogPlain12,
780 "ToggleButton.background", control,
781 "ToggleButton.foreground", controlText,
782 "ToggleButton.shadow", controlShadow,
783 "ToggleButton.darkShadow", controlDkShadow,
784 "ToggleButton.light", controlHighlight,
785 "ToggleButton.highlight", controlLtHighlight,
786 "ToggleButton.border", buttonToggleBorder,
787 "ToggleButton.margin", new InsetsUIResource(2, 14, 2, 14),
788 "ToggleButton.textIconGap", four,
789 "ToggleButton.textShiftOffset", zero,
790 "ToggleButton.focusInputMap",
791 new UIDefaults.LazyInputMap(new Object[] {
792 "SPACE", "pressed",
793 "released SPACE", "released"
794 }),
795
796 "RadioButton.font", dialogPlain12,
797 "RadioButton.background", control,
798 "RadioButton.foreground", controlText,
799 "RadioButton.shadow", controlShadow,
800 "RadioButton.darkShadow", controlDkShadow,
801 "RadioButton.light", controlHighlight,
802 "RadioButton.highlight", controlLtHighlight,
803 "RadioButton.border", radioButtonBorder,
804 "RadioButton.margin", twoInsets,
805 "RadioButton.textIconGap", four,
806 "RadioButton.textShiftOffset", zero,
807 "RadioButton.icon", radioButtonIcon,
808 "RadioButton.focusInputMap",
809 new UIDefaults.LazyInputMap(new Object[] {
810 "SPACE", "pressed",
811 "released SPACE", "released",
812 "RETURN", "pressed"
813 }),
814
815 "CheckBox.font", dialogPlain12,
816 "CheckBox.background", control,
817 "CheckBox.foreground", controlText,
818 "CheckBox.border", radioButtonBorder,
819 "CheckBox.margin", twoInsets,
820 "CheckBox.textIconGap", four,
821 "CheckBox.textShiftOffset", zero,
822 "CheckBox.icon", checkBoxIcon,
823 "CheckBox.focusInputMap",
824 new UIDefaults.LazyInputMap(new Object[] {
825 "SPACE", "pressed",
826 "released SPACE", "released"
827 }),
828 "FileChooser.useSystemExtensionHiding", Boolean.FALSE,
829
830 // *** ColorChooser
831 "ColorChooser.font", dialogPlain12,
832 "ColorChooser.background", control,
833 "ColorChooser.foreground", controlText,
834
835 "ColorChooser.swatchesSwatchSize", new Dimension(10, 10),
836 "ColorChooser.swatchesRecentSwatchSize", new Dimension(10, 10),
837 "ColorChooser.swatchesDefaultRecentColor", control,
838
839 // *** ComboBox
840 "ComboBox.font", sansSerifPlain12,
841 "ComboBox.background", window,
842 "ComboBox.foreground", textText,
843 "ComboBox.buttonBackground", control,
844 "ComboBox.buttonShadow", controlShadow,
845 "ComboBox.buttonDarkShadow", controlDkShadow,
846 "ComboBox.buttonHighlight", controlLtHighlight,
847 "ComboBox.selectionBackground", textHighlight,
848 "ComboBox.selectionForeground", textHighlightText,
849 "ComboBox.disabledBackground", control,
850 "ComboBox.disabledForeground", textInactiveText,
851 "ComboBox.timeFactor", oneThousand,
852 "ComboBox.isEnterSelectablePopup", Boolean.FALSE,
853 "ComboBox.ancestorInputMap",
854 new UIDefaults.LazyInputMap(new Object[] {
855 "ESCAPE", "hidePopup",
856 "PAGE_UP", "pageUpPassThrough",
857 "PAGE_DOWN", "pageDownPassThrough",
858 "HOME", "homePassThrough",
859 "END", "endPassThrough",
860 "ENTER", "enterPressed"
861 }),
862
863 // *** FileChooser
864
865 "FileChooser.newFolderIcon", newFolderIcon,
866 "FileChooser.upFolderIcon", upFolderIcon,
867 "FileChooser.homeFolderIcon", homeFolderIcon,
868 "FileChooser.detailsViewIcon", detailsViewIcon,
869 "FileChooser.listViewIcon", listViewIcon,
870 "FileChooser.readOnly", Boolean.FALSE,
871 "FileChooser.usesSingleFilePane", Boolean.FALSE,
872 "FileChooser.ancestorInputMap",
873 new UIDefaults.LazyInputMap(new Object[] {
874 "ESCAPE", "cancelSelection",
875 "F5", "refresh",
876 }),
877
878 "FileView.directoryIcon", directoryIcon,
879 "FileView.fileIcon", fileIcon,
880 "FileView.computerIcon", computerIcon,
881 "FileView.hardDriveIcon", hardDriveIcon,
882 "FileView.floppyDriveIcon", floppyDriveIcon,
883
884 // *** InternalFrame
885 "InternalFrame.titleFont", dialogBold12,
886 "InternalFrame.borderColor", control,
887 "InternalFrame.borderShadow", controlShadow,
888 "InternalFrame.borderDarkShadow", controlDkShadow,
889 "InternalFrame.borderHighlight", controlLtHighlight,
890 "InternalFrame.borderLight", controlHighlight,
891 "InternalFrame.border", internalFrameBorder,
892 "InternalFrame.icon", SwingUtilities2.makeIcon(getClass(),
893 BasicLookAndFeel.class,
894 "icons/JavaCup16.png"),
895
896 /* Default frame icons are undefined for Basic. */
897 "InternalFrame.maximizeIcon",
898 new SwingLazyValue(
899 "javax.swing.plaf.basic.BasicIconFactory",
900 "createEmptyFrameIcon"),
901 "InternalFrame.minimizeIcon",
902 new SwingLazyValue(
903 "javax.swing.plaf.basic.BasicIconFactory",
904 "createEmptyFrameIcon"),
905 "InternalFrame.iconifyIcon",
906 new SwingLazyValue(
907 "javax.swing.plaf.basic.BasicIconFactory",
908 "createEmptyFrameIcon"),
909 "InternalFrame.closeIcon",
910 new SwingLazyValue(
911 "javax.swing.plaf.basic.BasicIconFactory",
912 "createEmptyFrameIcon"),
913 // InternalFrame Auditory Cue Mappings
914 "InternalFrame.closeSound", null,
915 "InternalFrame.maximizeSound", null,
916 "InternalFrame.minimizeSound", null,
917 "InternalFrame.restoreDownSound", null,
918 "InternalFrame.restoreUpSound", null,
919
920 "InternalFrame.activeTitleBackground", table.get("activeCaption"),
921 "InternalFrame.activeTitleForeground", table.get("activeCaptionText"),
922 "InternalFrame.inactiveTitleBackground", table.get("inactiveCaption"),
923 "InternalFrame.inactiveTitleForeground", table.get("inactiveCaptionText"),
924 "InternalFrame.windowBindings", new Object[] {
925 "shift ESCAPE", "showSystemMenu",
926 "ctrl SPACE", "showSystemMenu",
927 "ESCAPE", "hideSystemMenu"},
928
929 "InternalFrameTitlePane.iconifyButtonOpacity", Boolean.TRUE,
930 "InternalFrameTitlePane.maximizeButtonOpacity", Boolean.TRUE,
931 "InternalFrameTitlePane.closeButtonOpacity", Boolean.TRUE,
932
933 "DesktopIcon.border", internalFrameBorder,
934
935 "Desktop.minOnScreenInsets", threeInsets,
936 "Desktop.background", table.get("desktop"),
937 "Desktop.ancestorInputMap",
938 new UIDefaults.LazyInputMap(new Object[] {
939 "ctrl F5", "restore",
940 "ctrl F4", "close",
941 "ctrl F7", "move",
942 "ctrl F8", "resize",
943 "RIGHT", "right",
944 "KP_RIGHT", "right",
945 "shift RIGHT", "shrinkRight",
946 "shift KP_RIGHT", "shrinkRight",
947 "LEFT", "left",
948 "KP_LEFT", "left",
949 "shift LEFT", "shrinkLeft",
950 "shift KP_LEFT", "shrinkLeft",
951 "UP", "up",
952 "KP_UP", "up",
953 "shift UP", "shrinkUp",
954 "shift KP_UP", "shrinkUp",
955 "DOWN", "down",
956 "KP_DOWN", "down",
957 "shift DOWN", "shrinkDown",
958 "shift KP_DOWN", "shrinkDown",
959 "ESCAPE", "escape",
960 "ctrl F9", "minimize",
961 "ctrl F10", "maximize",
962 "ctrl F6", "selectNextFrame",
963 "ctrl TAB", "selectNextFrame",
964 "ctrl alt F6", "selectNextFrame",
965 "shift ctrl alt F6", "selectPreviousFrame",
966 "ctrl F12", "navigateNext",
967 "shift ctrl F12", "navigatePrevious"
968 }),
969
970 // *** Label
971 "Label.font", dialogPlain12,
972 "Label.background", control,
973 "Label.foreground", controlText,
974 "Label.disabledForeground", white,
975 "Label.disabledShadow", controlShadow,
976 "Label.border", null,
977
978 // *** List
979 "List.font", dialogPlain12,
980 "List.background", window,
981 "List.foreground", textText,
982 "List.selectionBackground", textHighlight,
983 "List.selectionForeground", textHighlightText,
984 "List.noFocusBorder", noFocusBorder,
985 "List.focusCellHighlightBorder", focusCellHighlightBorder,
986 "List.dropLineColor", controlShadow,
987 "List.border", null,
988 "List.cellRenderer", listCellRendererActiveValue,
989 "List.timeFactor", oneThousand,
990 "List.focusInputMap",
991 new UIDefaults.LazyInputMap(new Object[] {
992 "ctrl C", "copy",
993 "ctrl V", "paste",
994 "ctrl X", "cut",
995 "COPY", "copy",
996 "PASTE", "paste",
997 "CUT", "cut",
998 "control INSERT", "copy",
999 "shift INSERT", "paste",
1000 "shift DELETE", "cut",
1001 "UP", "selectPreviousRow",
1002 "KP_UP", "selectPreviousRow",
1003 "shift UP", "selectPreviousRowExtendSelection",
1004 "shift KP_UP", "selectPreviousRowExtendSelection",
1005 "ctrl shift UP", "selectPreviousRowExtendSelection",
1006 "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
1007 "ctrl UP", "selectPreviousRowChangeLead",
1008 "ctrl KP_UP", "selectPreviousRowChangeLead",
1009 "DOWN", "selectNextRow",
1010 "KP_DOWN", "selectNextRow",
1011 "shift DOWN", "selectNextRowExtendSelection",
1012 "shift KP_DOWN", "selectNextRowExtendSelection",
1013 "ctrl shift DOWN", "selectNextRowExtendSelection",
1014 "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
1015 "ctrl DOWN", "selectNextRowChangeLead",
1016 "ctrl KP_DOWN", "selectNextRowChangeLead",
1017 "LEFT", "selectPreviousColumn",
1018 "KP_LEFT", "selectPreviousColumn",
1019 "shift LEFT", "selectPreviousColumnExtendSelection",
1020 "shift KP_LEFT", "selectPreviousColumnExtendSelection",
1021 "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
1022 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
1023 "ctrl LEFT", "selectPreviousColumnChangeLead",
1024 "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
1025 "RIGHT", "selectNextColumn",
1026 "KP_RIGHT", "selectNextColumn",
1027 "shift RIGHT", "selectNextColumnExtendSelection",
1028 "shift KP_RIGHT", "selectNextColumnExtendSelection",
1029 "ctrl shift RIGHT", "selectNextColumnExtendSelection",
1030 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
1031 "ctrl RIGHT", "selectNextColumnChangeLead",
1032 "ctrl KP_RIGHT", "selectNextColumnChangeLead",
1033 "HOME", "selectFirstRow",
1034 "shift HOME", "selectFirstRowExtendSelection",
1035 "ctrl shift HOME", "selectFirstRowExtendSelection",
1036 "ctrl HOME", "selectFirstRowChangeLead",
1037 "END", "selectLastRow",
1038 "shift END", "selectLastRowExtendSelection",
1039 "ctrl shift END", "selectLastRowExtendSelection",
1040 "ctrl END", "selectLastRowChangeLead",
1041 "PAGE_UP", "scrollUp",
1042 "shift PAGE_UP", "scrollUpExtendSelection",
1043 "ctrl shift PAGE_UP", "scrollUpExtendSelection",
1044 "ctrl PAGE_UP", "scrollUpChangeLead",
1045 "PAGE_DOWN", "scrollDown",
1046 "shift PAGE_DOWN", "scrollDownExtendSelection",
1047 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
1048 "ctrl PAGE_DOWN", "scrollDownChangeLead",
1049 "ctrl A", "selectAll",
1050 "ctrl SLASH", "selectAll",
1051 "ctrl BACK_SLASH", "clearSelection",
1052 "SPACE", "addToSelection",
1053 "ctrl SPACE", "toggleAndAnchor",
1054 "shift SPACE", "extendTo",
1055 "ctrl shift SPACE", "moveSelectionTo"
1056 }),
1057 "List.focusInputMap.RightToLeft",
1058 new UIDefaults.LazyInputMap(new Object[] {
1059 "LEFT", "selectNextColumn",
1060 "KP_LEFT", "selectNextColumn",
1061 "shift LEFT", "selectNextColumnExtendSelection",
1062 "shift KP_LEFT", "selectNextColumnExtendSelection",
1063 "ctrl shift LEFT", "selectNextColumnExtendSelection",
1064 "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
1065 "ctrl LEFT", "selectNextColumnChangeLead",
1066 "ctrl KP_LEFT", "selectNextColumnChangeLead",
1067 "RIGHT", "selectPreviousColumn",
1068 "KP_RIGHT", "selectPreviousColumn",
1069 "shift RIGHT", "selectPreviousColumnExtendSelection",
1070 "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
1071 "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
1072 "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
1073 "ctrl RIGHT", "selectPreviousColumnChangeLead",
1074 "ctrl KP_RIGHT", "selectPreviousColumnChangeLead",
1075 }),
1076
1077 // *** Menus
1078 "MenuBar.font", dialogPlain12,
1079 "MenuBar.background", menu,
1080 "MenuBar.foreground", menuText,
1081 "MenuBar.shadow", controlShadow,
1082 "MenuBar.highlight", controlLtHighlight,
1083 "MenuBar.border", menuBarBorder,
1084 "MenuBar.windowBindings", new Object[] {
1085 "F10", "takeFocus" },
1086
1087 "MenuItem.font", dialogPlain12,
1088 "MenuItem.acceleratorFont", dialogPlain12,
1089 "MenuItem.background", menu,
1090 "MenuItem.foreground", menuText,
1091 "MenuItem.selectionForeground", textHighlightText,
1092 "MenuItem.selectionBackground", textHighlight,
1093 "MenuItem.disabledForeground", null,
1094 "MenuItem.acceleratorForeground", menuText,
1095 "MenuItem.acceleratorSelectionForeground", textHighlightText,
1096 "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
1097 "MenuItem.border", marginBorder,
1098 "MenuItem.borderPainted", Boolean.FALSE,
1099 "MenuItem.margin", twoInsets,
1100 "MenuItem.checkIcon", menuItemCheckIcon,
1101 "MenuItem.arrowIcon", menuItemArrowIcon,
1102 "MenuItem.commandSound", null,
1103
1104 "RadioButtonMenuItem.font", dialogPlain12,
1105 "RadioButtonMenuItem.acceleratorFont", dialogPlain12,
1106 "RadioButtonMenuItem.background", menu,
1107 "RadioButtonMenuItem.foreground", menuText,
1108 "RadioButtonMenuItem.selectionForeground", textHighlightText,
1109 "RadioButtonMenuItem.selectionBackground", textHighlight,
1110 "RadioButtonMenuItem.disabledForeground", null,
1111 "RadioButtonMenuItem.acceleratorForeground", menuText,
1112 "RadioButtonMenuItem.acceleratorSelectionForeground", textHighlightText,
1113 "RadioButtonMenuItem.border", marginBorder,
1114 "RadioButtonMenuItem.borderPainted", Boolean.FALSE,
1115 "RadioButtonMenuItem.margin", twoInsets,
1116 "RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon,
1117 "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon,
1118 "RadioButtonMenuItem.commandSound", null,
1119
1120 "CheckBoxMenuItem.font", dialogPlain12,
1121 "CheckBoxMenuItem.acceleratorFont", dialogPlain12,
1122 "CheckBoxMenuItem.background", menu,
1123 "CheckBoxMenuItem.foreground", menuText,
1124 "CheckBoxMenuItem.selectionForeground", textHighlightText,
1125 "CheckBoxMenuItem.selectionBackground", textHighlight,
1126 "CheckBoxMenuItem.disabledForeground", null,
1127 "CheckBoxMenuItem.acceleratorForeground", menuText,
1128 "CheckBoxMenuItem.acceleratorSelectionForeground", textHighlightText,
1129 "CheckBoxMenuItem.border", marginBorder,
1130 "CheckBoxMenuItem.borderPainted", Boolean.FALSE,
1131 "CheckBoxMenuItem.margin", twoInsets,
1132 "CheckBoxMenuItem.checkIcon", checkBoxMenuItemIcon,
1133 "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon,
1134 "CheckBoxMenuItem.commandSound", null,
1135
1136 "Menu.font", dialogPlain12,
1137 "Menu.acceleratorFont", dialogPlain12,
1138 "Menu.background", menu,
1139 "Menu.foreground", menuText,
1140 "Menu.selectionForeground", textHighlightText,
1141 "Menu.selectionBackground", textHighlight,
1142 "Menu.disabledForeground", null,
1143 "Menu.acceleratorForeground", menuText,
1144 "Menu.acceleratorSelectionForeground", textHighlightText,
1145 "Menu.border", marginBorder,
1146 "Menu.borderPainted", Boolean.FALSE,
1147 "Menu.margin", twoInsets,
1148 "Menu.checkIcon", menuItemCheckIcon,
1149 "Menu.arrowIcon", menuArrowIcon,
1150 "Menu.menuPopupOffsetX", new Integer(0),
1151 "Menu.menuPopupOffsetY", new Integer(0),
1152 "Menu.submenuPopupOffsetX", new Integer(0),
1153 "Menu.submenuPopupOffsetY", new Integer(0),
1154 "Menu.shortcutKeys", new int[] {KeyEvent.ALT_MASK},
1155 "Menu.crossMenuMnemonic", Boolean.TRUE,
1156 // Menu.cancelMode affects the cancel menu action behaviour;
1157 // currently supports:
1158 // "hideLastSubmenu" (default)
1159 // hides the last open submenu,
1160 // and move selection one step back
1161 // "hideMenuTree"
1162 // resets selection and
1163 // hide the entire structure of open menu and its submenus
1164 "Menu.cancelMode", "hideLastSubmenu",
1165
1166 // Menu.preserveTopLevelSelection affects
1167 // the cancel menu action behaviour
1168 // if set to true then top level menu selection
1169 // will be preserved when the last popup was cancelled;
1170 // the menu itself will be unselect with the next cancel action
1171 "Menu.preserveTopLevelSelection", Boolean.FALSE,
1172
1173 // PopupMenu
1174 "PopupMenu.font", dialogPlain12,
1175 "PopupMenu.background", menu,
1176 "PopupMenu.foreground", menuText,
1177 "PopupMenu.border", popupMenuBorder,
1178 // Internal Frame Auditory Cue Mappings
1179 "PopupMenu.popupSound", null,
1180 // These window InputMap bindings are used when the Menu is
1181 // selected.
1182 "PopupMenu.selectedWindowInputMapBindings", new Object[] {
1183 "ESCAPE", "cancel",
1184 "DOWN", "selectNext",
1185 "KP_DOWN", "selectNext",
1186 "UP", "selectPrevious",
1187 "KP_UP", "selectPrevious",
1188 "LEFT", "selectParent",
1189 "KP_LEFT", "selectParent",
1190 "RIGHT", "selectChild",
1191 "KP_RIGHT", "selectChild",
1192 "ENTER", "return",
1193 "ctrl ENTER", "return",
1194 "SPACE", "return"
1195 },
1196 "PopupMenu.selectedWindowInputMapBindings.RightToLeft", new Object[] {
1197 "LEFT", "selectChild",
1198 "KP_LEFT", "selectChild",
1199 "RIGHT", "selectParent",
1200 "KP_RIGHT", "selectParent",
1201 },
1202 "PopupMenu.consumeEventOnClose", Boolean.FALSE,
1203
1204 // *** OptionPane
1205 // You can additionaly define OptionPane.messageFont which will
1206 // dictate the fonts used for the message, and
1207 // OptionPane.buttonFont, which defines the font for the buttons.
1208 "OptionPane.font", dialogPlain12,
1209 "OptionPane.background", control,
1210 "OptionPane.foreground", controlText,
1211 "OptionPane.messageForeground", controlText,
1212 "OptionPane.border", optionPaneBorder,
1213 "OptionPane.messageAreaBorder", zeroBorder,
1214 "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder,
1215 "OptionPane.minimumSize", optionPaneMinimumSize,
1216 "OptionPane.errorIcon", SwingUtilities2.makeIcon(getClass(),
1217 BasicLookAndFeel.class,
1218 "icons/Error.gif"),
1219 "OptionPane.informationIcon", SwingUtilities2.makeIcon(getClass(),
1220 BasicLookAndFeel.class,
1221 "icons/Inform.gif"),
1222 "OptionPane.warningIcon", SwingUtilities2.makeIcon(getClass(),
1223 BasicLookAndFeel.class,
1224 "icons/Warn.gif"),
1225 "OptionPane.questionIcon", SwingUtilities2.makeIcon(getClass(),
1226 BasicLookAndFeel.class,
1227 "icons/Question.gif"),
1228 "OptionPane.windowBindings", new Object[] {
1229 "ESCAPE", "close" },
1230 // OptionPane Auditory Cue Mappings
1231 "OptionPane.errorSound", null,
1232 "OptionPane.informationSound", null, // Info and Plain
1233 "OptionPane.questionSound", null,
1234 "OptionPane.warningSound", null,
1235 "OptionPane.buttonClickThreshhold", fiveHundred,
1236
1237 // *** Panel
1238 "Panel.font", dialogPlain12,
1239 "Panel.background", control,
1240 "Panel.foreground", textText,
1241
1242 // *** ProgressBar
1243 "ProgressBar.font", dialogPlain12,
1244 "ProgressBar.foreground", textHighlight,
1245 "ProgressBar.background", control,
1246 "ProgressBar.selectionForeground", control,
1247 "ProgressBar.selectionBackground", textHighlight,
1248 "ProgressBar.border", progressBarBorder,
1249 "ProgressBar.cellLength", new Integer(1),
1250 "ProgressBar.cellSpacing", zero,
1251 "ProgressBar.repaintInterval", new Integer(50),
1252 "ProgressBar.cycleTime", new Integer(3000),
1253 "ProgressBar.horizontalSize", new DimensionUIResource(146, 12),
1254 "ProgressBar.verticalSize", new DimensionUIResource(12, 146),
1255
1256 // *** Separator
1257 "Separator.shadow", controlShadow, // DEPRECATED - DO NOT USE!
1258 "Separator.highlight", controlLtHighlight, // DEPRECATED - DO NOT USE!
1259
1260 "Separator.background", controlLtHighlight,
1261 "Separator.foreground", controlShadow,
1262
1263 // *** ScrollBar/ScrollPane/Viewport
1264 "ScrollBar.background", scrollBarTrack,
1265 "ScrollBar.foreground", control,
1266 "ScrollBar.track", table.get("scrollbar"),
1267 "ScrollBar.trackHighlight", controlDkShadow,
1268 "ScrollBar.thumb", control,
1269 "ScrollBar.thumbHighlight", controlLtHighlight,
1270 "ScrollBar.thumbDarkShadow", controlDkShadow,
1271 "ScrollBar.thumbShadow", controlShadow,
1272 "ScrollBar.border", null,
1273 "ScrollBar.minimumThumbSize", minimumThumbSize,
1274 "ScrollBar.maximumThumbSize", maximumThumbSize,
1275 "ScrollBar.ancestorInputMap",
1276 new UIDefaults.LazyInputMap(new Object[] {
1277 "RIGHT", "positiveUnitIncrement",
1278 "KP_RIGHT", "positiveUnitIncrement",
1279 "DOWN", "positiveUnitIncrement",
1280 "KP_DOWN", "positiveUnitIncrement",
1281 "PAGE_DOWN", "positiveBlockIncrement",
1282 "LEFT", "negativeUnitIncrement",
1283 "KP_LEFT", "negativeUnitIncrement",
1284 "UP", "negativeUnitIncrement",
1285 "KP_UP", "negativeUnitIncrement",
1286 "PAGE_UP", "negativeBlockIncrement",
1287 "HOME", "minScroll",
1288 "END", "maxScroll"
1289 }),
1290 "ScrollBar.ancestorInputMap.RightToLeft",
1291 new UIDefaults.LazyInputMap(new Object[] {
1292 "RIGHT", "negativeUnitIncrement",
1293 "KP_RIGHT", "negativeUnitIncrement",
1294 "LEFT", "positiveUnitIncrement",
1295 "KP_LEFT", "positiveUnitIncrement",
1296 }),
1297 "ScrollBar.width", new Integer(16),
1298
1299 "ScrollPane.font", dialogPlain12,
1300 "ScrollPane.background", control,
1301 "ScrollPane.foreground", controlText,
1302 "ScrollPane.border", textFieldBorder,
1303 "ScrollPane.viewportBorder", null,
1304 "ScrollPane.ancestorInputMap",
1305 new UIDefaults.LazyInputMap(new Object[] {
1306 "RIGHT", "unitScrollRight",
1307 "KP_RIGHT", "unitScrollRight",
1308 "DOWN", "unitScrollDown",
1309 "KP_DOWN", "unitScrollDown",
1310 "LEFT", "unitScrollLeft",
1311 "KP_LEFT", "unitScrollLeft",
1312 "UP", "unitScrollUp",
1313 "KP_UP", "unitScrollUp",
1314 "PAGE_UP", "scrollUp",
1315 "PAGE_DOWN", "scrollDown",
1316 "ctrl PAGE_UP", "scrollLeft",
1317 "ctrl PAGE_DOWN", "scrollRight",
1318 "ctrl HOME", "scrollHome",
1319 "ctrl END", "scrollEnd"
1320 }),
1321 "ScrollPane.ancestorInputMap.RightToLeft",
1322 new UIDefaults.LazyInputMap(new Object[] {
1323 "ctrl PAGE_UP", "scrollRight",
1324 "ctrl PAGE_DOWN", "scrollLeft",
1325 }),
1326
1327 "Viewport.font", dialogPlain12,
1328 "Viewport.background", control,
1329 "Viewport.foreground", textText,
1330
1331 // *** Slider
1332 "Slider.font", dialogPlain12,
1333 "Slider.foreground", control,
1334 "Slider.background", control,
1335 "Slider.highlight", controlLtHighlight,
1336 "Slider.tickColor", Color.black,
1337 "Slider.shadow", controlShadow,
1338 "Slider.focus", controlDkShadow,
1339 "Slider.border", null,
1340 "Slider.horizontalSize", new Dimension(200, 21),
1341 "Slider.verticalSize", new Dimension(21, 200),
1342 "Slider.minimumHorizontalSize", new Dimension(36, 21),
1343 "Slider.minimumVerticalSize", new Dimension(21, 36),
1344 "Slider.focusInsets", sliderFocusInsets,
1345 "Slider.focusInputMap",
1346 new UIDefaults.LazyInputMap(new Object[] {
1347 "RIGHT", "positiveUnitIncrement",
1348 "KP_RIGHT", "positiveUnitIncrement",
1349 "DOWN", "negativeUnitIncrement",
1350 "KP_DOWN", "negativeUnitIncrement",
1351 "PAGE_DOWN", "negativeBlockIncrement",
1352 "LEFT", "negativeUnitIncrement",
1353 "KP_LEFT", "negativeUnitIncrement",
1354 "UP", "positiveUnitIncrement",
1355 "KP_UP", "positiveUnitIncrement",
1356 "PAGE_UP", "positiveBlockIncrement",
1357 "HOME", "minScroll",
1358 "END", "maxScroll"
1359 }),
1360 "Slider.focusInputMap.RightToLeft",
1361 new UIDefaults.LazyInputMap(new Object[] {
1362 "RIGHT", "negativeUnitIncrement",
1363 "KP_RIGHT", "negativeUnitIncrement",
1364 "LEFT", "positiveUnitIncrement",
1365 "KP_LEFT", "positiveUnitIncrement",
1366 }),
1367 "Slider.onlyLeftMouseButtonDrag", Boolean.TRUE,
1368
1369 // *** Spinner
1370 "Spinner.font", monospacedPlain12,
1371 "Spinner.background", control,
1372 "Spinner.foreground", control,
1373 "Spinner.border", textFieldBorder,
1374 "Spinner.arrowButtonBorder", null,
1375 "Spinner.arrowButtonInsets", null,
1376 "Spinner.arrowButtonSize", new Dimension(16, 5),
1377 "Spinner.ancestorInputMap",
1378 new UIDefaults.LazyInputMap(new Object[] {
1379 "UP", "increment",
1380 "KP_UP", "increment",
1381 "DOWN", "decrement",
1382 "KP_DOWN", "decrement",
1383 }),
1384 "Spinner.editorBorderPainted", Boolean.FALSE,
1385 "Spinner.editorAlignment", JTextField.TRAILING,
1386
1387 // *** SplitPane
1388 "SplitPane.background", control,
1389 "SplitPane.highlight", controlLtHighlight,
1390 "SplitPane.shadow", controlShadow,
1391 "SplitPane.darkShadow", controlDkShadow,
1392 "SplitPane.border", splitPaneBorder,
1393 "SplitPane.dividerSize", new Integer(7),
1394 "SplitPaneDivider.border", splitPaneDividerBorder,
1395 "SplitPaneDivider.draggingColor", darkGray,
1396 "SplitPane.ancestorInputMap",
1397 new UIDefaults.LazyInputMap(new Object[] {
1398 "UP", "negativeIncrement",
1399 "DOWN", "positiveIncrement",
1400 "LEFT", "negativeIncrement",
1401 "RIGHT", "positiveIncrement",
1402 "KP_UP", "negativeIncrement",
1403 "KP_DOWN", "positiveIncrement",
1404 "KP_LEFT", "negativeIncrement",
1405 "KP_RIGHT", "positiveIncrement",
1406 "HOME", "selectMin",
1407 "END", "selectMax",
1408 "F8", "startResize",
1409 "F6", "toggleFocus",
1410 "ctrl TAB", "focusOutForward",
1411 "ctrl shift TAB", "focusOutBackward"
1412 }),
1413
1414 // *** TabbedPane
1415 "TabbedPane.font", dialogPlain12,
1416 "TabbedPane.background", control,
1417 "TabbedPane.foreground", controlText,
1418 "TabbedPane.highlight", controlLtHighlight,
1419 "TabbedPane.light", controlHighlight,
1420 "TabbedPane.shadow", controlShadow,
1421 "TabbedPane.darkShadow", controlDkShadow,
1422 "TabbedPane.selected", null,
1423 "TabbedPane.focus", controlText,
1424 "TabbedPane.textIconGap", four,
1425
1426 // Causes tabs to be painted on top of the content area border.
1427 // The amount of overlap is then controlled by tabAreaInsets.bottom,
1428 // which is zero by default
1429 "TabbedPane.tabsOverlapBorder", Boolean.FALSE,
1430 "TabbedPane.selectionFollowsFocus", Boolean.TRUE,
1431
1432 "TabbedPane.labelShift", 1,
1433 "TabbedPane.selectedLabelShift", -1,
1434 "TabbedPane.tabInsets", tabbedPaneTabInsets,
1435 "TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets,
1436 "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
1437 "TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets,
1438 "TabbedPane.tabRunOverlay", new Integer(2),
1439 "TabbedPane.tabsOpaque", Boolean.TRUE,
1440 "TabbedPane.contentOpaque", Boolean.TRUE,
1441 "TabbedPane.focusInputMap",
1442 new UIDefaults.LazyInputMap(new Object[] {
1443 "RIGHT", "navigateRight",
1444 "KP_RIGHT", "navigateRight",
1445 "LEFT", "navigateLeft",
1446 "KP_LEFT", "navigateLeft",
1447 "UP", "navigateUp",
1448 "KP_UP", "navigateUp",
1449 "DOWN", "navigateDown",
1450 "KP_DOWN", "navigateDown",
1451 "ctrl DOWN", "requestFocusForVisibleComponent",
1452 "ctrl KP_DOWN", "requestFocusForVisibleComponent",
1453 }),
1454 "TabbedPane.ancestorInputMap",
1455 new UIDefaults.LazyInputMap(new Object[] {
1456 "ctrl PAGE_DOWN", "navigatePageDown",
1457 "ctrl PAGE_UP", "navigatePageUp",
1458 "ctrl UP", "requestFocus",
1459 "ctrl KP_UP", "requestFocus",
1460 }),
1461
1462
1463 // *** Table
1464 "Table.font", dialogPlain12,
1465 "Table.foreground", controlText, // cell text color
1466 "Table.background", window, // cell background color
1467 "Table.selectionForeground", textHighlightText,
1468 "Table.selectionBackground", textHighlight,
1469 "Table.dropLineColor", controlShadow,
1470 "Table.dropLineShortColor", black,
1471 "Table.gridColor", gray, // grid line color
1472 "Table.focusCellBackground", window,
1473 "Table.focusCellForeground", controlText,
1474 "Table.focusCellHighlightBorder", focusCellHighlightBorder,
1475 "Table.scrollPaneBorder", loweredBevelBorder,
1476 "Table.ancestorInputMap",
1477 new UIDefaults.LazyInputMap(new Object[] {
1478 "ctrl C", "copy",
1479 "ctrl V", "paste",
1480 "ctrl X", "cut",
1481 "COPY", "copy",
1482 "PASTE", "paste",
1483 "CUT", "cut",
1484 "control INSERT", "copy",
1485 "shift INSERT", "paste",
1486 "shift DELETE", "cut",
1487 "RIGHT", "selectNextColumn",
1488 "KP_RIGHT", "selectNextColumn",
1489 "shift RIGHT", "selectNextColumnExtendSelection",
1490 "shift KP_RIGHT", "selectNextColumnExtendSelection",
1491 "ctrl shift RIGHT", "selectNextColumnExtendSelection",
1492 "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
1493 "ctrl RIGHT", "selectNextColumnChangeLead",
1494 "ctrl KP_RIGHT", "selectNextColumnChangeLead",
1495 "LEFT", "selectPreviousColumn",
1496 "KP_LEFT", "selectPreviousColumn",
1497 "shift LEFT", "selectPreviousColumnExtendSelection",
1498 "shift KP_LEFT", "selectPreviousColumnExtendSelection",
1499 "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
1500 "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
1501 "ctrl LEFT", "selectPreviousColumnChangeLead",
1502 "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
1503 "DOWN", "selectNextRow",
1504 "KP_DOWN", "selectNextRow",
1505 "shift DOWN", "selectNextRowExtendSelection",
1506 "shift KP_DOWN", "selectNextRowExtendSelection",
1507 "ctrl shift DOWN", "selectNextRowExtendSelection",
1508 "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
1509 "ctrl DOWN", "selectNextRowChangeLead",
1510 "ctrl KP_DOWN", "selectNextRowChangeLead",
1511 "UP", "selectPreviousRow",
1512 "KP_UP", "selectPreviousRow",
1513 "shift UP", "selectPreviousRowExtendSelection",
1514 "shift KP_UP", "selectPreviousRowExtendSelection",
1515 "ctrl shift UP", "selectPreviousRowExtendSelection",
1516 "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
1517 "ctrl UP", "selectPreviousRowChangeLead",
1518 "ctrl KP_UP", "selectPreviousRowChangeLead",
1519 "HOME", "selectFirstColumn",
1520 "shift HOME", "selectFirstColumnExtendSelection",
1521 "ctrl shift HOME", "selectFirstRowExtendSelection",
1522 "ctrl HOME", "selectFirstRow",
1523 "END", "selectLastColumn",
1524 "shift END", "selectLastColumnExtendSelection",
1525 "ctrl shift END", "selectLastRowExtendSelection",
1526 "ctrl END", "selectLastRow",
1527 "PAGE_UP", "scrollUpChangeSelection",
1528 "shift PAGE_UP", "scrollUpExtendSelection",
1529 "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
1530 "ctrl PAGE_UP", "scrollLeftChangeSelection",
1531 "PAGE_DOWN", "scrollDownChangeSelection",
1532 "shift PAGE_DOWN", "scrollDownExtendSelection",
1533 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
1534 "ctrl PAGE_DOWN", "scrollRightChangeSelection",
1535 "TAB", "selectNextColumnCell",
1536 "shift TAB", "selectPreviousColumnCell",
1537 "ENTER", "selectNextRowCell",
1538 "shift ENTER", "selectPreviousRowCell",
1539 "ctrl A", "selectAll",
1540 "ctrl SLASH", "selectAll",
1541 "ctrl BACK_SLASH", "clearSelection",
1542 "ESCAPE", "cancel",
1543 "F2", "startEditing",
1544 "SPACE", "addToSelection",
1545 "ctrl SPACE", "toggleAndAnchor",
1546 "shift SPACE", "extendTo",
1547 "ctrl shift SPACE", "moveSelectionTo",
1548 "F8", "focusHeader"
1549 }),
1550 "Table.ancestorInputMap.RightToLeft",
1551 new UIDefaults.LazyInputMap(new Object[] {
1552 "RIGHT", "selectPreviousColumn",
1553 "KP_RIGHT", "selectPreviousColumn",
1554 "shift RIGHT", "selectPreviousColumnExtendSelection",
1555 "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
1556 "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
1557 "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
1558 "ctrl RIGHT", "selectPreviousColumnChangeLead",
1559 "ctrl KP_RIGHT", "selectPreviousColumnChangeLead",
1560 "LEFT", "selectNextColumn",
1561 "KP_LEFT", "selectNextColumn",
1562 "shift LEFT", "selectNextColumnExtendSelection",
1563 "shift KP_LEFT", "selectNextColumnExtendSelection",
1564 "ctrl shift LEFT", "selectNextColumnExtendSelection",
1565 "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
1566 "ctrl LEFT", "selectNextColumnChangeLead",
1567 "ctrl KP_LEFT", "selectNextColumnChangeLead",
1568 "ctrl PAGE_UP", "scrollRightChangeSelection",
1569 "ctrl PAGE_DOWN", "scrollLeftChangeSelection",
1570 "ctrl shift PAGE_UP", "scrollRightExtendSelection",
1571 "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
1572 }),
1573 "Table.ascendingSortIcon", new SwingLazyValue(
1574 "sun.swing.icon.SortArrowIcon",
1575 null, new Object[] { Boolean.TRUE,
1576 "Table.sortIconColor" }),
1577 "Table.descendingSortIcon", new SwingLazyValue(
1578 "sun.swing.icon.SortArrowIcon",
1579 null, new Object[] { Boolean.FALSE,
1580 "Table.sortIconColor" }),
1581 "Table.sortIconColor", controlShadow,
1582
1583 "TableHeader.font", dialogPlain12,
1584 "TableHeader.foreground", controlText, // header text color
1585 "TableHeader.background", control, // header background
1586 "TableHeader.cellBorder", tableHeaderBorder,
1587
1588 // Support for changing the background/border of the currently
1589 // selected header column when the header has the keyboard focus.
1590 "TableHeader.focusCellBackground", table.getColor("text"), // like text component bg
1591 "TableHeader.focusCellForeground", null,
1592 "TableHeader.focusCellBorder", null,
1593 "TableHeader.ancestorInputMap",
1594 new UIDefaults.LazyInputMap(new Object[] {
1595 "SPACE", "toggleSortOrder",
1596 "LEFT", "selectColumnToLeft",
1597 "KP_LEFT", "selectColumnToLeft",
1598 "RIGHT", "selectColumnToRight",
1599 "KP_RIGHT", "selectColumnToRight",
1600 "alt LEFT", "moveColumnLeft",
1601 "alt KP_LEFT", "moveColumnLeft",
1602 "alt RIGHT", "moveColumnRight",
1603 "alt KP_RIGHT", "moveColumnRight",
1604 "alt shift LEFT", "resizeLeft",
1605 "alt shift KP_LEFT", "resizeLeft",
1606 "alt shift RIGHT", "resizeRight",
1607 "alt shift KP_RIGHT", "resizeRight",
1608 "ESCAPE", "focusTable",
1609 }),
1610
1611 // *** Text
1612 "TextField.font", sansSerifPlain12,
1613 "TextField.background", window,
1614 "TextField.foreground", textText,
1615 "TextField.shadow", controlShadow,
1616 "TextField.darkShadow", controlDkShadow,
1617 "TextField.light", controlHighlight,
1618 "TextField.highlight", controlLtHighlight,
1619 "TextField.inactiveForeground", textInactiveText,
1620 "TextField.inactiveBackground", control,
1621 "TextField.selectionBackground", textHighlight,
1622 "TextField.selectionForeground", textHighlightText,
1623 "TextField.caretForeground", textText,
1624 "TextField.caretBlinkRate", caretBlinkRate,
1625 "TextField.border", textFieldBorder,
1626 "TextField.margin", zeroInsets,
1627
1628 "FormattedTextField.font", sansSerifPlain12,
1629 "FormattedTextField.background", window,
1630 "FormattedTextField.foreground", textText,
1631 "FormattedTextField.inactiveForeground", textInactiveText,
1632 "FormattedTextField.inactiveBackground", control,
1633 "FormattedTextField.selectionBackground", textHighlight,
1634 "FormattedTextField.selectionForeground", textHighlightText,
1635 "FormattedTextField.caretForeground", textText,
1636 "FormattedTextField.caretBlinkRate", caretBlinkRate,
1637 "FormattedTextField.border", textFieldBorder,
1638 "FormattedTextField.margin", zeroInsets,
1639 "FormattedTextField.focusInputMap",
1640 new UIDefaults.LazyInputMap(new Object[] {
1641 "ctrl C", DefaultEditorKit.copyAction,
1642 "ctrl V", DefaultEditorKit.pasteAction,
1643 "ctrl X", DefaultEditorKit.cutAction,
1644 "COPY", DefaultEditorKit.copyAction,
1645 "PASTE", DefaultEditorKit.pasteAction,
1646 "CUT", DefaultEditorKit.cutAction,
1647 "control INSERT", DefaultEditorKit.copyAction,
1648 "shift INSERT", DefaultEditorKit.pasteAction,
1649 "shift DELETE", DefaultEditorKit.cutAction,
1650 "shift LEFT", DefaultEditorKit.selectionBackwardAction,
1651 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
1652 "shift RIGHT", DefaultEditorKit.selectionForwardAction,
1653 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
1654 "ctrl LEFT", DefaultEditorKit.previousWordAction,
1655 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
1656 "ctrl RIGHT", DefaultEditorKit.nextWordAction,
1657 "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
1658 "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
1659 "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
1660 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
1661 "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
1662 "ctrl A", DefaultEditorKit.selectAllAction,
1663 "HOME", DefaultEditorKit.beginLineAction,
1664 "END", DefaultEditorKit.endLineAction,
1665 "shift HOME", DefaultEditorKit.selectionBeginLineAction,
1666 "shift END", DefaultEditorKit.selectionEndLineAction,
1667 "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
1668 "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
1669 "ctrl H", DefaultEditorKit.deletePrevCharAction,
1670 "DELETE", DefaultEditorKit.deleteNextCharAction,
1671 "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
1672 "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
1673 "RIGHT", DefaultEditorKit.forwardAction,
1674 "LEFT", DefaultEditorKit.backwardAction,
1675 "KP_RIGHT", DefaultEditorKit.forwardAction,
1676 "KP_LEFT", DefaultEditorKit.backwardAction,
1677 "ENTER", JTextField.notifyAction,
1678 "ctrl BACK_SLASH", "unselect",
1679 "control shift O", "toggle-componentOrientation",
1680 "ESCAPE", "reset-field-edit",
1681 "UP", "increment",
1682 "KP_UP", "increment",
1683 "DOWN", "decrement",
1684 "KP_DOWN", "decrement",
1685 }),
1686
1687 "PasswordField.font", monospacedPlain12,
1688 "PasswordField.background", window,
1689 "PasswordField.foreground", textText,
1690 "PasswordField.inactiveForeground", textInactiveText,
1691 "PasswordField.inactiveBackground", control,
1692 "PasswordField.selectionBackground", textHighlight,
1693 "PasswordField.selectionForeground", textHighlightText,
1694 "PasswordField.caretForeground", textText,
1695 "PasswordField.caretBlinkRate", caretBlinkRate,
1696 "PasswordField.border", textFieldBorder,
1697 "PasswordField.margin", zeroInsets,
1698 "PasswordField.echoChar", '*',
1699
1700 "TextArea.font", monospacedPlain12,
1701 "TextArea.background", window,
1702 "TextArea.foreground", textText,
1703 "TextArea.inactiveForeground", textInactiveText,
1704 "TextArea.selectionBackground", textHighlight,
1705 "TextArea.selectionForeground", textHighlightText,
1706 "TextArea.caretForeground", textText,
1707 "TextArea.caretBlinkRate", caretBlinkRate,
1708 "TextArea.border", marginBorder,
1709 "TextArea.margin", zeroInsets,
1710
1711 "TextPane.font", serifPlain12,
1712 "TextPane.background", white,
1713 "TextPane.foreground", textText,
1714 "TextPane.selectionBackground", textHighlight,
1715 "TextPane.selectionForeground", textHighlightText,
1716 "TextPane.caretForeground", textText,
1717 "TextPane.caretBlinkRate", caretBlinkRate,
1718 "TextPane.inactiveForeground", textInactiveText,
1719 "TextPane.border", marginBorder,
1720 "TextPane.margin", editorMargin,
1721
1722 "EditorPane.font", serifPlain12,
1723 "EditorPane.background", white,
1724 "EditorPane.foreground", textText,
1725 "EditorPane.selectionBackground", textHighlight,
1726 "EditorPane.selectionForeground", textHighlightText,
1727 "EditorPane.caretForeground", textText,
1728 "EditorPane.caretBlinkRate", caretBlinkRate,
1729 "EditorPane.inactiveForeground", textInactiveText,
1730 "EditorPane.border", marginBorder,
1731 "EditorPane.margin", editorMargin,
1732
1733 "html.pendingImage", SwingUtilities2.makeIcon(getClass(),
1734 BasicLookAndFeel.class,
1735 "icons/image-delayed.png"),
1736 "html.missingImage", SwingUtilities2.makeIcon(getClass(),
1737 BasicLookAndFeel.class,
1738 "icons/image-failed.png"),
1739 // *** TitledBorder
1740 "TitledBorder.font", dialogPlain12,
1741 "TitledBorder.titleColor", controlText,
1742 "TitledBorder.border", etchedBorder,
1743
1744 // *** ToolBar
1745 "ToolBar.font", dialogPlain12,
1746 "ToolBar.background", control,
1747 "ToolBar.foreground", controlText,
1748 "ToolBar.shadow", controlShadow,
1749 "ToolBar.darkShadow", controlDkShadow,
1750 "ToolBar.light", controlHighlight,
1751 "ToolBar.highlight", controlLtHighlight,
1752 "ToolBar.dockingBackground", control,
1753 "ToolBar.dockingForeground", red,
1754 "ToolBar.floatingBackground", control,
1755 "ToolBar.floatingForeground", darkGray,
1756 "ToolBar.border", etchedBorder,
1757 "ToolBar.separatorSize", toolBarSeparatorSize,
1758 "ToolBar.ancestorInputMap",
1759 new UIDefaults.LazyInputMap(new Object[] {
1760 "UP", "navigateUp",
1761 "KP_UP", "navigateUp",
1762 "DOWN", "navigateDown",
1763 "KP_DOWN", "navigateDown",
1764 "LEFT", "navigateLeft",
1765 "KP_LEFT", "navigateLeft",
1766 "RIGHT", "navigateRight",
1767 "KP_RIGHT", "navigateRight"
1768 }),
1769
1770 // *** ToolTips
1771 "ToolTip.font", sansSerifPlain12,
1772 "ToolTip.background", table.get("info"),
1773 "ToolTip.foreground", table.get("infoText"),
1774 "ToolTip.border", blackLineBorder,
1775 // ToolTips also support backgroundInactive, borderInactive,
1776 // and foregroundInactive
1777
1778 // *** ToolTipManager
1779 // ToolTipManager.enableToolTipMode currently supports:
1780 // "allWindows" (default):
1781 // enables tool tips for all windows of all java applications,
1782 // whether the windows are active or inactive
1783 // "activeApplication"
1784 // enables tool tips for windows of an application only when
1785 // the application has an active window
1786 "ToolTipManager.enableToolTipMode", "allWindows",
1787
1788 // *** Tree
1789 "Tree.paintLines", Boolean.TRUE,
1790 "Tree.lineTypeDashed", Boolean.FALSE,
1791 "Tree.font", dialogPlain12,
1792 "Tree.background", window,
1793 "Tree.foreground", textText,
1794 "Tree.hash", gray,
1795 "Tree.textForeground", textText,
1796 "Tree.textBackground", table.get("text"),
1797 "Tree.selectionForeground", textHighlightText,
1798 "Tree.selectionBackground", textHighlight,
1799 "Tree.selectionBorderColor", black,
1800 "Tree.dropLineColor", controlShadow,
1801 "Tree.editorBorder", blackLineBorder,
1802 "Tree.leftChildIndent", new Integer(7),
1803 "Tree.rightChildIndent", new Integer(13),
1804 "Tree.rowHeight", new Integer(16),
1805 "Tree.scrollsOnExpand", Boolean.TRUE,
1806 "Tree.openIcon", SwingUtilities2.makeIcon(getClass(),
1807 BasicLookAndFeel.class,
1808 "icons/TreeOpen.gif"),
1809 "Tree.closedIcon", SwingUtilities2.makeIcon(getClass(),
1810 BasicLookAndFeel.class,
1811 "icons/TreeClosed.gif"),
1812 "Tree.leafIcon", SwingUtilities2.makeIcon(getClass(),
1813 BasicLookAndFeel.class,
1814 "icons/TreeLeaf.gif"),
1815 "Tree.expandedIcon", null,
1816 "Tree.collapsedIcon", null,
1817 "Tree.changeSelectionWithFocus", Boolean.TRUE,
1818 "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE,
1819 "Tree.timeFactor", oneThousand,
1820 "Tree.focusInputMap",
1821 new UIDefaults.LazyInputMap(new Object[] {
1822 "ctrl C", "copy",
1823 "ctrl V", "paste",
1824 "ctrl X", "cut",
1825 "COPY", "copy",
1826 "PASTE", "paste",
1827 "CUT", "cut",
1828 "control INSERT", "copy",
1829 "shift INSERT", "paste",
1830 "shift DELETE", "cut",
1831 "UP", "selectPrevious",
1832 "KP_UP", "selectPrevious",
1833 "shift UP", "selectPreviousExtendSelection",
1834 "shift KP_UP", "selectPreviousExtendSelection",
1835 "ctrl shift UP", "selectPreviousExtendSelection",
1836 "ctrl shift KP_UP", "selectPreviousExtendSelection",
1837 "ctrl UP", "selectPreviousChangeLead",
1838 "ctrl KP_UP", "selectPreviousChangeLead",
1839 "DOWN", "selectNext",
1840 "KP_DOWN", "selectNext",
1841 "shift DOWN", "selectNextExtendSelection",
1842 "shift KP_DOWN", "selectNextExtendSelection",
1843 "ctrl shift DOWN", "selectNextExtendSelection",
1844 "ctrl shift KP_DOWN", "selectNextExtendSelection",
1845 "ctrl DOWN", "selectNextChangeLead",
1846 "ctrl KP_DOWN", "selectNextChangeLead",
1847 "RIGHT", "selectChild",
1848 "KP_RIGHT", "selectChild",
1849 "LEFT", "selectParent",
1850 "KP_LEFT", "selectParent",
1851 "PAGE_UP", "scrollUpChangeSelection",
1852 "shift PAGE_UP", "scrollUpExtendSelection",
1853 "ctrl shift PAGE_UP", "scrollUpExtendSelection",
1854 "ctrl PAGE_UP", "scrollUpChangeLead",
1855 "PAGE_DOWN", "scrollDownChangeSelection",
1856 "shift PAGE_DOWN", "scrollDownExtendSelection",
1857 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
1858 "ctrl PAGE_DOWN", "scrollDownChangeLead",
1859 "HOME", "selectFirst",
1860 "shift HOME", "selectFirstExtendSelection",
1861 "ctrl shift HOME", "selectFirstExtendSelection",
1862 "ctrl HOME", "selectFirstChangeLead",
1863 "END", "selectLast",
1864 "shift END", "selectLastExtendSelection",
1865 "ctrl shift END", "selectLastExtendSelection",
1866 "ctrl END", "selectLastChangeLead",
1867 "F2", "startEditing",
1868 "ctrl A", "selectAll",
1869 "ctrl SLASH", "selectAll",
1870 "ctrl BACK_SLASH", "clearSelection",
1871 "ctrl LEFT", "scrollLeft",
1872 "ctrl KP_LEFT", "scrollLeft",
1873 "ctrl RIGHT", "scrollRight",
1874 "ctrl KP_RIGHT", "scrollRight",
1875 "SPACE", "addToSelection",
1876 "ctrl SPACE", "toggleAndAnchor",
1877 "shift SPACE", "extendTo",
1878 "ctrl shift SPACE", "moveSelectionTo"
1879 }),
1880 "Tree.focusInputMap.RightToLeft",
1881 new UIDefaults.LazyInputMap(new Object[] {
1882 "RIGHT", "selectParent",
1883 "KP_RIGHT", "selectParent",
1884 "LEFT", "selectChild",
1885 "KP_LEFT", "selectChild",
1886 }),
1887 "Tree.ancestorInputMap",
1888 new UIDefaults.LazyInputMap(new Object[] {
1889 "ESCAPE", "cancel"
1890 }),
1891 // Bind specific keys that can invoke popup on currently
1892 // focused JComponent
1893 "RootPane.ancestorInputMap",
1894 new UIDefaults.LazyInputMap(new Object[] {
1895 "shift F10", "postPopup",
1896 "CONTEXT_MENU", "postPopup"
1897 }),
1898
1899 // These bindings are only enabled when there is a default
1900 // button set on the rootpane.
1901 "RootPane.defaultButtonWindowKeyBindings", new Object[] {
1902 "ENTER", "press",
1903 "released ENTER", "release",
1904 "ctrl ENTER", "press",
1905 "ctrl released ENTER", "release"
1906 },
1907 };
1908
1909 table.putDefaults(defaults);
1910 }
1911
1912
1913 /**
1914 * Returns the ui that is of type <code>klass</code>, or null if
1915 * one can not be found.
1916 */
1917 static Object getUIOfType(ComponentUI ui, Class klass) {
1918 if (klass.isInstance(ui)) {
1919 return ui;
1920 }
1921 return null;
1922 }
1923
1924 // ********* Auditory Cue support methods and objects *********
1925 // also see the "AuditoryCues" section of the defaults table
1926
1927 /**
1928 * Returns an <code>ActionMap</code> containing the audio actions
1929 * for this look and feel.
1930 * <P>
1931 * The returned <code>ActionMap</code> contains <code>Actions</code> that
1932 * embody the ability to render an auditory cue. These auditory
1933 * cues map onto user and system activities that may be useful
1934 * for an end user to know about (such as a dialog box appearing).
1935 * <P>
1936 * At the appropriate time,
1937 * the {@code ComponentUI} is responsible for obtaining an
1938 * <code>Action</code> out of the <code>ActionMap</code> and passing
1939 * it to <code>playSound</code>.
1940 * <P>
1941 * This method first looks up the {@code ActionMap} from the
1942 * defaults using the key {@code "AuditoryCues.actionMap"}.
1943 * <p>
1944 * If the value is {@code non-null}, it is returned. If the value
1945 * of the default {@code "AuditoryCues.actionMap"} is {@code null}
1946 * and the value of the default {@code "AuditoryCues.cueList"} is
1947 * {@code non-null}, an {@code ActionMapUIResource} is created and
1948 * populated. Population is done by iterating over each of the
1949 * elements of the {@code "AuditoryCues.cueList"} array, and
1950 * invoking {@code createAudioAction()} to create an {@code
1951 * Action} for each element. The resulting {@code Action} is
1952 * placed in the {@code ActionMapUIResource}, using the array
1953 * element as the key. For example, if the {@code
1954 * "AuditoryCues.cueList"} array contains a single-element, {@code
1955 * "audioKey"}, the {@code ActionMapUIResource} is created, then
1956 * populated by way of {@code actionMap.put(cueList[0],
1957 * createAudioAction(cueList[0]))}.
1958 * <p>
1959 * If the value of the default {@code "AuditoryCues.actionMap"} is
1960 * {@code null} and the value of the default
1961 * {@code "AuditoryCues.cueList"} is {@code null}, an empty
1962 * {@code