1/*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. 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.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package com.sun.java.swing.plaf.motif;
27
28import java.awt.Color;
29import java.awt.Font;
30import java.awt.Insets;
31import java.awt.event.KeyEvent;
32import java.awt.event.InputEvent;
33import java.util.*;
34
35import javax.swing.*;
36import javax.swing.plaf.*;
37import javax.swing.border.*;
38import javax.swing.text.JTextComponent;
39import javax.swing.text.DefaultEditorKit;
40
41import javax.swing.plaf.basic.BasicLookAndFeel;
42import javax.swing.plaf.basic.BasicBorders;
43import javax.swing.plaf.basic.BasicComboBoxRenderer;
44import javax.swing.plaf.basic.BasicComboBoxEditor;
45
46import sun.swing.SwingAccessor;
47import sun.swing.SwingUtilities2;
48import sun.awt.OSInfo;
49
50/**
51 * Implements the Motif Look and Feel.
52 * UI classes not implemented specifically for Motif will
53 * default to those implemented in Basic.
54 * <p>
55 * <strong>Warning:</strong>
56 * Serialized objects of this class will not be compatible with
57 * future Swing releases.  The current serialization support is appropriate
58 * for short term storage or RMI between applications running the same
59 * version of Swing.  A future release of Swing will provide support for
60 * long term persistence.
61 *
62 * @author unattributed
63 */
64@SuppressWarnings("serial") // Superclass is not serializable across versions
65public class MotifLookAndFeel extends BasicLookAndFeel
66{
67    public String getName() {
68        return "CDE/Motif";
69    }
70
71    public String getID() {
72        return "Motif";
73    }
74
75    public String getDescription() {
76        return "The CDE/Motif Look and Feel";
77    }
78
79
80    public boolean isNativeLookAndFeel() {
81        return OSInfo.getOSType() == OSInfo.OSType.SOLARIS;
82    }
83
84
85    public boolean isSupportedLookAndFeel() {
86        return true;
87    }
88
89
90    /**
91     * Load the SystemColors into the defaults table.  The keys
92     * for SystemColor defaults are the same as the names of
93     * the public fields in SystemColor.  If the table is being
94     * created on a native Motif platform we use the SystemColor
95     * values, otherwise we create color objects whose values match
96     * the default CDE/Motif colors.
97     */
98    protected void initSystemColorDefaults(UIDefaults table)
99    {
100        String[] defaultSystemColors = {
101                  "desktop", "#005C5C", /* Color of the desktop background */
102            "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
103        "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
104      "activeCaptionBorder", "#B24D7A", /* Border color for caption (title bar) window borders. */
105          "inactiveCaption", "#AEB2C3", /* Color for captions (title bars) when not active. */
106      "inactiveCaptionText", "#000000", /* Text color for text in inactive captions (title bars). */
107    "inactiveCaptionBorder", "#AEB2C3", /* Border color for inactive caption (title bar) window borders. */
108                   "window", "#AEB2C3", /* Default color for the interior of windows */
109             "windowBorder", "#AEB2C3", /* ??? */
110               "windowText", "#000000", /* ??? */
111                     "menu", "#AEB2C3", /* ??? */
112                 "menuText", "#000000", /* ??? */
113                     "text", "#FFF7E9", /* Text background color */
114                 "textText", "#000000", /* Text foreground color */
115            "textHighlight", "#000000", /* Text background color when selected */
116        "textHighlightText", "#FFF7E9", /* Text color when selected */
117         "textInactiveText", "#808080", /* Text color when disabled */
118                  "control", "#AEB2C3", /* Default color for controls (buttons, sliders, etc) */
119              "controlText", "#000000", /* Default color for text in controls */
120         "controlHighlight", "#DCDEE5", /* Highlight color for controls */
121       "controlLtHighlight", "#DCDEE5", /* Light highlight color for controls */
122            "controlShadow", "#63656F", /* Shadow color for controls */
123       "controlLightShadow", "#9397A5", /* Shadow color for controls */
124          "controlDkShadow", "#000000", /* Dark shadow color for controls */
125                "scrollbar", "#AEB2C3", /* Scrollbar ??? color. PENDING(jeff) foreground? background? ?*/
126                     "info", "#FFF7E9", /* ??? */
127                 "infoText", "#000000"  /* ??? */
128        };
129
130        loadSystemColors(table, defaultSystemColors, false);
131    }
132
133
134    protected void initClassDefaults(UIDefaults table)
135    {
136        super.initClassDefaults(table);
137        String motifPackageName = "com.sun.java.swing.plaf.motif.";
138
139        Object[] uiDefaults = {
140                   "ButtonUI", motifPackageName + "MotifButtonUI",
141                 "CheckBoxUI", motifPackageName + "MotifCheckBoxUI",
142            "DirectoryPaneUI", motifPackageName + "MotifDirectoryPaneUI",
143              "FileChooserUI", motifPackageName + "MotifFileChooserUI",
144                    "LabelUI", motifPackageName + "MotifLabelUI",
145                  "MenuBarUI", motifPackageName + "MotifMenuBarUI",
146                     "MenuUI", motifPackageName + "MotifMenuUI",
147                 "MenuItemUI", motifPackageName + "MotifMenuItemUI",
148         "CheckBoxMenuItemUI", motifPackageName + "MotifCheckBoxMenuItemUI",
149      "RadioButtonMenuItemUI", motifPackageName + "MotifRadioButtonMenuItemUI",
150              "RadioButtonUI", motifPackageName + "MotifRadioButtonUI",
151             "ToggleButtonUI", motifPackageName + "MotifToggleButtonUI",
152                "PopupMenuUI", motifPackageName + "MotifPopupMenuUI",
153              "ProgressBarUI", motifPackageName + "MotifProgressBarUI",
154                "ScrollBarUI", motifPackageName + "MotifScrollBarUI",
155               "ScrollPaneUI", motifPackageName + "MotifScrollPaneUI",
156                   "SliderUI", motifPackageName + "MotifSliderUI",
157                "SplitPaneUI", motifPackageName + "MotifSplitPaneUI",
158               "TabbedPaneUI", motifPackageName + "MotifTabbedPaneUI",
159                 "TextAreaUI", motifPackageName + "MotifTextAreaUI",
160                "TextFieldUI", motifPackageName + "MotifTextFieldUI",
161            "PasswordFieldUI", motifPackageName + "MotifPasswordFieldUI",
162                 "TextPaneUI", motifPackageName + "MotifTextPaneUI",
163               "EditorPaneUI", motifPackageName + "MotifEditorPaneUI",
164                     "TreeUI", motifPackageName + "MotifTreeUI",
165            "InternalFrameUI", motifPackageName + "MotifInternalFrameUI",
166              "DesktopPaneUI", motifPackageName + "MotifDesktopPaneUI",
167                "SeparatorUI", motifPackageName + "MotifSeparatorUI",
168       "PopupMenuSeparatorUI", motifPackageName + "MotifPopupMenuSeparatorUI",
169               "OptionPaneUI", motifPackageName + "MotifOptionPaneUI",
170                 "ComboBoxUI", motifPackageName + "MotifComboBoxUI",
171              "DesktopIconUI", motifPackageName + "MotifDesktopIconUI"
172        };
173
174        table.putDefaults(uiDefaults);
175    }
176
177
178    /**
179     * Initialize the defaults table with the name of the ResourceBundle
180     * used for getting localized defaults.
181     */
182    private void initResourceBundle(UIDefaults table) {
183        SwingAccessor.getUIDefaultsAccessor()
184                     .addInternalBundle(table,
185                             "com.sun.java.swing.plaf.motif.resources.motif");
186    }
187
188
189    protected void initComponentDefaults(UIDefaults table)
190    {
191        super.initComponentDefaults(table);
192
193        initResourceBundle(table);
194
195        FontUIResource dialogPlain12 = new FontUIResource(Font.DIALOG,
196                                                          Font.PLAIN, 12);
197        FontUIResource serifPlain12 = new FontUIResource(Font.SERIF,
198                                                          Font.PLAIN, 12);
199        FontUIResource sansSerifPlain12 = new FontUIResource(Font.SANS_SERIF,
200                                                          Font.PLAIN, 12);
201        FontUIResource monospacedPlain12 = new FontUIResource(Font.MONOSPACED,
202                                                          Font.PLAIN, 12);
203        ColorUIResource red = new ColorUIResource(Color.red);
204        ColorUIResource black = new ColorUIResource(Color.black);
205        ColorUIResource white = new ColorUIResource(Color.white);
206        ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
207        ColorUIResource controlDarker = new ColorUIResource(147, 151, 165);  // slate blue
208        ColorUIResource scrollBarTrack = controlDarker;
209        ColorUIResource menuItemPressedBackground = new ColorUIResource(165,165,165);
210        ColorUIResource menuItemPressedForeground = new ColorUIResource(0,0,0);
211
212
213        Border loweredBevelBorder = new MotifBorders.BevelBorder(false,
214                                           table.getColor("controlShadow"),
215                                           table.getColor("controlLtHighlight"));
216
217        Border raisedBevelBorder = new MotifBorders.BevelBorder(true,                                                                  table.getColor("controlShadow"),
218                                           table.getColor("controlLtHighlight"));
219
220        Border marginBorder = new BasicBorders.MarginBorder();
221
222        Border focusBorder = new MotifBorders.FocusBorder(
223                                           table.getColor("control"),
224                                           table.getColor("activeCaptionBorder"));
225
226
227        Border focusBevelBorder = new BorderUIResource.CompoundBorderUIResource(
228                                          focusBorder,
229                                          loweredBevelBorder);
230
231        Border comboBoxBorder = new BorderUIResource.CompoundBorderUIResource(
232                                          focusBorder,
233                                          raisedBevelBorder);
234
235
236        Border buttonBorder = new BorderUIResource.CompoundBorderUIResource(
237                                      new MotifBorders.ButtonBorder(
238                                          table.getColor("Button.shadow"),
239                                          table.getColor("Button.highlight"),
240                                          table.getColor("Button.darkShadow"),
241                                          table.getColor("activeCaptionBorder")),
242                                      marginBorder);
243
244        Border toggleButtonBorder = new BorderUIResource.CompoundBorderUIResource(
245                                      new MotifBorders.ToggleButtonBorder(
246                                          table.getColor("ToggleButton.shadow"),
247                                          table.getColor("ToggleButton.highlight"),
248                                          table.getColor("ToggleButton.darkShadow"),
249                                          table.getColor("activeCaptionBorder")),                                                        marginBorder);
250
251        Border textFieldBorder = new BorderUIResource.CompoundBorderUIResource(
252                                      focusBevelBorder,
253                                      marginBorder);
254
255        Border popupMenuBorder = new BorderUIResource.CompoundBorderUIResource(
256                                      raisedBevelBorder,
257                                      new MotifBorders.MotifPopupMenuBorder(
258                                        table.getFont("PopupMenu.font"),
259                                        table.getColor("PopupMenu.background"),
260                                        table.getColor("PopupMenu.foreground"),
261                                        table.getColor("controlShadow"),
262                                        table.getColor("controlLtHighlight")
263                                        ));
264
265        Object menuItemCheckIcon = new UIDefaults.LazyValue() {
266            public Object createValue(UIDefaults table) {
267                return MotifIconFactory.getMenuItemCheckIcon();
268            }
269        };
270
271        Object menuItemArrowIcon = new UIDefaults.LazyValue() {
272            public Object createValue(UIDefaults table) {
273                return MotifIconFactory.getMenuItemArrowIcon();
274            }
275        };
276
277        Object menuArrowIcon = new UIDefaults.LazyValue() {
278            public Object createValue(UIDefaults table) {
279                return MotifIconFactory.getMenuArrowIcon();
280            }
281        };
282
283        Object checkBoxIcon = new UIDefaults.LazyValue() {
284            public Object createValue(UIDefaults table) {
285                return MotifIconFactory.getCheckBoxIcon();
286            }
287        };
288
289        Object radioButtonIcon = new UIDefaults.LazyValue() {
290            public Object createValue(UIDefaults table) {
291                return MotifIconFactory.getRadioButtonIcon();
292            }
293        };
294
295        Object unselectedTabBackground = new UIDefaults.LazyValue() {
296            public Object createValue(UIDefaults table) {
297                Color c = table.getColor("control");
298                return new ColorUIResource(Math.max((int)(c.getRed()*.85),0),
299                                           Math.max((int)(c.getGreen()*.85),0),
300                                           Math.max((int)(c.getBlue()*.85),0));
301            }
302        };
303
304        Object unselectedTabForeground = new UIDefaults.LazyValue() {
305            public Object createValue(UIDefaults table) {
306                Color c = table.getColor("controlText");
307                return new ColorUIResource(Math.max((int)(c.getRed()*.85),0),
308                                           Math.max((int)(c.getGreen()*.85),0),
309                                           Math.max((int)(c.getBlue()*.85),0));
310            }
311        };
312
313        Object unselectedTabShadow = new UIDefaults.LazyValue() {
314            public Object createValue(UIDefaults table) {
315                Color c = table.getColor("control");
316                Color base = new Color(Math.max((int)(c.getRed()*.85),0),
317                                       Math.max((int)(c.getGreen()*.85),0),
318                                       Math.max((int)(c.getBlue()*.85),0));
319                return new ColorUIResource(base.darker());
320            }
321        };
322
323        Object unselectedTabHighlight = new UIDefaults.LazyValue() {
324            public Object createValue(UIDefaults table) {
325                Color c = table.getColor("control");
326                Color base = new Color(Math.max((int)(c.getRed()*.85),0),
327                                       Math.max((int)(c.getGreen()*.85),0),
328                                       Math.max((int)(c.getBlue()*.85),0));
329                return new ColorUIResource(base.brighter());
330            }
331        };
332
333        // *** Text
334
335        Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
336                           "COPY", DefaultEditorKit.copyAction,
337                          "PASTE", DefaultEditorKit.pasteAction,
338                            "CUT", DefaultEditorKit.cutAction,
339                 "control INSERT", DefaultEditorKit.copyAction,
340                   "shift INSERT", DefaultEditorKit.pasteAction,
341                   "shift DELETE", DefaultEditorKit.cutAction,
342                      "control F", DefaultEditorKit.forwardAction,
343                      "control B", DefaultEditorKit.backwardAction,
344                      "control D", DefaultEditorKit.deleteNextCharAction,
345                     "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
346               "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
347                         "ctrl H", DefaultEditorKit.deletePrevCharAction,
348                         "DELETE", DefaultEditorKit.deleteNextCharAction,
349                    "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
350                "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
351                          "RIGHT", DefaultEditorKit.forwardAction,
352                           "LEFT", DefaultEditorKit.backwardAction,
353                       "KP_RIGHT", DefaultEditorKit.forwardAction,
354                        "KP_LEFT", DefaultEditorKit.backwardAction,
355                     "shift LEFT", DefaultEditorKit.selectionBackwardAction,
356                    "shift RIGHT", DefaultEditorKit.selectionForwardAction,
357                   "control LEFT", DefaultEditorKit.previousWordAction,
358                  "control RIGHT", DefaultEditorKit.nextWordAction,
359             "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
360            "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
361                  "control SLASH", DefaultEditorKit.selectAllAction,
362                           "HOME", DefaultEditorKit.beginLineAction,
363                            "END", DefaultEditorKit.endLineAction,
364                     "shift HOME", DefaultEditorKit.selectionBeginLineAction,
365                      "shift END", DefaultEditorKit.selectionEndLineAction,
366             "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
367                          "ENTER", JTextField.notifyAction,
368                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
369        });
370
371        Object passwordInputMap = new UIDefaults.LazyInputMap(new Object[] {
372                           "COPY", DefaultEditorKit.copyAction,
373                          "PASTE", DefaultEditorKit.pasteAction,
374                            "CUT", DefaultEditorKit.cutAction,
375                 "control INSERT", DefaultEditorKit.copyAction,
376                   "shift INSERT", DefaultEditorKit.pasteAction,
377                   "shift DELETE", DefaultEditorKit.cutAction,
378                      "control F", DefaultEditorKit.forwardAction,
379                      "control B", DefaultEditorKit.backwardAction,
380                      "control D", DefaultEditorKit.deleteNextCharAction,
381                     "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
382               "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
383                         "ctrl H", DefaultEditorKit.deletePrevCharAction,
384                         "DELETE", DefaultEditorKit.deleteNextCharAction,
385                          "RIGHT", DefaultEditorKit.forwardAction,
386                           "LEFT", DefaultEditorKit.backwardAction,
387                       "KP_RIGHT", DefaultEditorKit.forwardAction,
388                        "KP_LEFT", DefaultEditorKit.backwardAction,
389                     "shift LEFT", DefaultEditorKit.selectionBackwardAction,
390                    "shift RIGHT", DefaultEditorKit.selectionForwardAction,
391                   "control LEFT", DefaultEditorKit.beginLineAction,
392                  "control RIGHT", DefaultEditorKit.endLineAction,
393             "control shift LEFT", DefaultEditorKit.selectionBeginLineAction,
394            "control shift RIGHT", DefaultEditorKit.selectionEndLineAction,
395                  "control SLASH", DefaultEditorKit.selectAllAction,
396                           "HOME", DefaultEditorKit.beginLineAction,
397                            "END", DefaultEditorKit.endLineAction,
398                     "shift HOME", DefaultEditorKit.selectionBeginLineAction,
399                      "shift END", DefaultEditorKit.selectionEndLineAction,
400             "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
401                          "ENTER", JTextField.notifyAction,
402                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
403        });
404
405        Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
406                           "COPY", DefaultEditorKit.copyAction,
407                          "PASTE", DefaultEditorKit.pasteAction,
408                            "CUT", DefaultEditorKit.cutAction,
409                 "control INSERT", DefaultEditorKit.copyAction,
410                   "shift INSERT", DefaultEditorKit.pasteAction,
411                   "shift DELETE", DefaultEditorKit.cutAction,
412                      "control F", DefaultEditorKit.forwardAction,
413                      "control B", DefaultEditorKit.backwardAction,
414                      "control D", DefaultEditorKit.deleteNextCharAction,
415                     "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
416               "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
417                         "ctrl H", DefaultEditorKit.deletePrevCharAction,
418                         "DELETE", DefaultEditorKit.deleteNextCharAction,
419                    "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
420                "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
421                          "RIGHT", DefaultEditorKit.forwardAction,
422                           "LEFT", DefaultEditorKit.backwardAction,
423                       "KP_RIGHT", DefaultEditorKit.forwardAction,
424                        "KP_LEFT", DefaultEditorKit.backwardAction,
425                     "shift LEFT", DefaultEditorKit.selectionBackwardAction,
426                    "shift RIGHT", DefaultEditorKit.selectionForwardAction,
427                   "control LEFT", DefaultEditorKit.previousWordAction,
428                  "control RIGHT", DefaultEditorKit.nextWordAction,
429             "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
430            "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
431                  "control SLASH", DefaultEditorKit.selectAllAction,
432                           "HOME", DefaultEditorKit.beginLineAction,
433                            "END", DefaultEditorKit.endLineAction,
434                     "shift HOME", DefaultEditorKit.selectionBeginLineAction,
435                      "shift END", DefaultEditorKit.selectionEndLineAction,
436
437                      "control N", DefaultEditorKit.downAction,
438                      "control P", DefaultEditorKit.upAction,
439                             "UP", DefaultEditorKit.upAction,
440                           "DOWN", DefaultEditorKit.downAction,
441                        "PAGE_UP", DefaultEditorKit.pageUpAction,
442                      "PAGE_DOWN", DefaultEditorKit.pageDownAction,
443                  "shift PAGE_UP", "selection-page-up",
444                "shift PAGE_DOWN", "selection-page-down",
445             "ctrl shift PAGE_UP", "selection-page-left",
446           "ctrl shift PAGE_DOWN", "selection-page-right",
447                       "shift UP", DefaultEditorKit.selectionUpAction,
448                     "shift DOWN", DefaultEditorKit.selectionDownAction,
449                          "ENTER", DefaultEditorKit.insertBreakAction,
450                            "TAB", DefaultEditorKit.insertTabAction,
451             "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
452                   "control HOME", DefaultEditorKit.beginAction,
453                    "control END", DefaultEditorKit.endAction,
454             "control shift HOME", DefaultEditorKit.selectionBeginAction,
455              "control shift END", DefaultEditorKit.selectionEndAction,
456                      "control T", "next-link-action",
457                "control shift T", "previous-link-action",
458                  "control SPACE", "activate-link-action",
459                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
460        });
461
462        // *** Tree
463
464        Object treeOpenIcon = SwingUtilities2.makeIcon(getClass(),
465                                                       MotifLookAndFeel.class,
466                                                       "icons/TreeOpen.gif");
467
468        Object treeClosedIcon = SwingUtilities2.makeIcon(getClass(),
469                                                         MotifLookAndFeel.class,
470                                                         "icons/TreeClosed.gif");
471
472        Object treeLeafIcon = new UIDefaults.LazyValue() {
473            public Object createValue(UIDefaults table) {
474                return MotifTreeCellRenderer.loadLeafIcon();
475            }
476        };
477
478        Object treeExpandedIcon = new UIDefaults.LazyValue() {
479            public Object createValue(UIDefaults table) {
480                return MotifTreeUI.MotifExpandedIcon.createExpandedIcon();
481            }
482        };
483
484        Object treeCollapsedIcon = new UIDefaults.LazyValue() {
485            public Object createValue(UIDefaults table) {
486                return MotifTreeUI.MotifCollapsedIcon.createCollapsedIcon();
487            }
488        };
489
490        Border menuBarBorder = new MotifBorders.MenuBarBorder(
491                                          table.getColor("MenuBar.shadow"),
492                                          table.getColor("MenuBar.highlight"),
493                                          table.getColor("MenuBar.darkShadow"),
494                                          table.getColor("activeCaptionBorder"));
495
496
497        Border menuMarginBorder = new BorderUIResource.CompoundBorderUIResource(
498                                          loweredBevelBorder,
499                                          marginBorder);
500
501
502        Border focusCellHighlightBorder = new BorderUIResource.LineBorderUIResource(
503                                                table.getColor("activeCaptionBorder"));
504
505        Object sliderFocusInsets = new InsetsUIResource( 0, 0, 0, 0 );
506
507        // ** for tabbedpane
508
509        Object tabbedPaneTabInsets = new InsetsUIResource(3, 4, 3, 4);
510
511        Object tabbedPaneTabPadInsets = new InsetsUIResource(3, 0, 1, 0);
512
513        Object tabbedPaneTabAreaInsets = new InsetsUIResource(4, 2, 0, 8);
514
515        Object tabbedPaneContentBorderInsets = new InsetsUIResource(2, 2, 2, 2);
516
517
518        // ** for optionpane
519
520        Object optionPaneBorder = new BorderUIResource.EmptyBorderUIResource(10,0,0,0);
521
522        Object optionPaneButtonAreaBorder = new BorderUIResource.EmptyBorderUIResource(10,10,10,10);
523
524        Object optionPaneMessageAreaBorder = new BorderUIResource.EmptyBorderUIResource(10,10,12,10);
525
526        @SuppressWarnings("deprecation")
527        final int metaMask = KeyEvent.META_MASK;
528        Object[] defaults = {
529
530            "Desktop.background", table.get("desktop"),
531            "Desktop.ancestorInputMap",
532               new UIDefaults.LazyInputMap(new Object[] {
533                 "ctrl F5", "restore",
534                 "ctrl F4", "close",
535                 "ctrl F7", "move",
536                 "ctrl F8", "resize",
537                   "RIGHT", "right",
538                "KP_RIGHT", "right",
539             "shift RIGHT", "shrinkRight",
540          "shift KP_RIGHT", "shrinkRight",
541                    "LEFT", "left",
542                 "KP_LEFT", "left",
543              "shift LEFT", "shrinkLeft",
544           "shift KP_LEFT", "shrinkLeft",
545                      "UP", "up",
546                   "KP_UP", "up",
547                "shift UP", "shrinkUp",
548             "shift KP_UP", "shrinkUp",
549                    "DOWN", "down",
550                 "KP_DOWN", "down",
551              "shift DOWN", "shrinkDown",
552           "shift KP_DOWN", "shrinkDown",
553                  "ESCAPE", "escape",
554                 "ctrl F9", "minimize",
555                "ctrl F10", "maximize",
556                 "ctrl F6", "selectNextFrame",
557                "ctrl TAB", "selectNextFrame",
558             "ctrl alt F6", "selectNextFrame",
559       "shift ctrl alt F6", "selectPreviousFrame",
560                "ctrl F12", "navigateNext",
561          "shift ctrl F12", "navigatePrevious"
562              }),
563
564            "Panel.background", table.get("control"),
565            "Panel.foreground", table.get("textText"),
566            "Panel.font", dialogPlain12,
567
568            "ProgressBar.font", dialogPlain12,
569            "ProgressBar.foreground", controlDarker,
570            "ProgressBar.background", table.get("control"),
571            "ProgressBar.selectionForeground", table.get("control"),
572            "ProgressBar.selectionBackground", table.get("controlText"),
573            "ProgressBar.border", loweredBevelBorder,
574            "ProgressBar.cellLength", 6,
575            "ProgressBar.cellSpacing", Integer.valueOf(0),
576
577            // Buttons
578            "Button.margin", new InsetsUIResource(2, 4, 2, 4),
579            "Button.border", buttonBorder,
580            "Button.background", table.get("control"),
581            "Button.foreground", table.get("controlText"),
582            "Button.select", table.get("controlLightShadow"),
583            "Button.font", dialogPlain12,
584            "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
585                          "SPACE", "pressed",
586                 "released SPACE", "released"
587              }),
588
589            "CheckBox.textIconGap", 8,
590            "CheckBox.margin", new InsetsUIResource(4, 2, 4, 2),
591            "CheckBox.icon", checkBoxIcon,
592            "CheckBox.focus", table.get("activeCaptionBorder"),
593            "CheckBox.focusInputMap",
594               new UIDefaults.LazyInputMap(new Object[] {
595                            "SPACE", "pressed",
596                   "released SPACE", "released"
597                 }),
598
599            "RadioButton.margin", new InsetsUIResource(4, 2, 4, 2),
600            "RadioButton.textIconGap", 8,
601            "RadioButton.background", table.get("control"),
602            "RadioButton.foreground", table.get("controlText"),
603            "RadioButton.icon", radioButtonIcon,
604            "RadioButton.focus", table.get("activeCaptionBorder"),
605            "RadioButton.icon", radioButtonIcon,
606            "RadioButton.focusInputMap",
607               new UIDefaults.LazyInputMap(new Object[] {
608                          "SPACE", "pressed",
609                 "released SPACE", "released"
610              }),
611
612            "ToggleButton.border", toggleButtonBorder,
613            "ToggleButton.background", table.get("control"),
614            "ToggleButton.foreground", table.get("controlText"),
615            "ToggleButton.focus", table.get("controlText"),
616            "ToggleButton.select", table.get("controlLightShadow"),
617            "ToggleButton.focusInputMap",
618              new UIDefaults.LazyInputMap(new Object[] {
619                            "SPACE", "pressed",
620                   "released SPACE", "released"
621                }),
622
623            // Menus
624            "Menu.border", menuMarginBorder,
625            "Menu.font", dialogPlain12,
626            "Menu.acceleratorFont", dialogPlain12,
627            "Menu.acceleratorSelectionForeground", menuItemPressedForeground,
628            "Menu.foreground", table.get("menuText"),
629            "Menu.background", table.get("menu"),
630            "Menu.selectionForeground", menuItemPressedForeground,
631            "Menu.selectionBackground", menuItemPressedBackground,
632            "Menu.checkIcon", menuItemCheckIcon,
633            "Menu.arrowIcon", menuArrowIcon,
634            "Menu.menuPopupOffsetX", 0,
635            "Menu.menuPopupOffsetY", 0,
636            "Menu.submenuPopupOffsetX", -2,
637            "Menu.submenuPopupOffsetY", 3,
638            "Menu.shortcutKeys", new int[]{
639                SwingUtilities2.getSystemMnemonicKeyMask(), metaMask
640            },
641            "Menu.cancelMode", "hideMenuTree",
642
643            "MenuBar.border", menuBarBorder,
644            "MenuBar.background", table.get("menu"),
645            "MenuBar.foreground", table.get("menuText"),
646            "MenuBar.font", dialogPlain12,
647            "MenuBar.windowBindings", new Object[] {
648                "F10", "takeFocus" },
649
650            "MenuItem.border", menuMarginBorder,
651            "MenuItem.font", dialogPlain12,
652            "MenuItem.acceleratorFont", dialogPlain12,
653            "MenuItem.acceleratorSelectionForeground", menuItemPressedForeground,
654            "MenuItem.foreground", table.get("menuText"),
655            "MenuItem.background", table.get("menu"),
656            "MenuItem.selectionForeground", menuItemPressedForeground,
657            "MenuItem.selectionBackground", menuItemPressedBackground,
658            "MenuItem.checkIcon", menuItemCheckIcon,
659            "MenuItem.arrowIcon", menuItemArrowIcon,
660
661            "RadioButtonMenuItem.border", menuMarginBorder,
662            "RadioButtonMenuItem.font", dialogPlain12,
663            "RadioButtonMenuItem.acceleratorFont", dialogPlain12,
664            "RadioButtonMenuItem.acceleratorSelectionForeground", menuItemPressedForeground,
665            "RadioButtonMenuItem.foreground", table.get("menuText"),
666            "RadioButtonMenuItem.background", table.get("menu"),
667            "RadioButtonMenuItem.selectionForeground", menuItemPressedForeground,
668            "RadioButtonMenuItem.selectionBackground", menuItemPressedBackground,
669            "RadioButtonMenuItem.checkIcon", radioButtonIcon,
670            "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon,
671
672            "CheckBoxMenuItem.border", menuMarginBorder,
673            "CheckBoxMenuItem.font", dialogPlain12,
674            "CheckBoxMenuItem.acceleratorFont", dialogPlain12,
675            "CheckBoxMenuItem.acceleratorSelectionForeground", menuItemPressedForeground,
676            "CheckBoxMenuItem.foreground", table.get("menuText"),
677            "CheckBoxMenuItem.background", table.get("menu"),
678            "CheckBoxMenuItem.selectionForeground", menuItemPressedForeground,
679            "CheckBoxMenuItem.selectionBackground", menuItemPressedBackground,
680            "CheckBoxMenuItem.checkIcon", checkBoxIcon,
681            "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon,
682
683            "PopupMenu.background", table.get("menu"),
684            "PopupMenu.border", popupMenuBorder,
685            "PopupMenu.foreground", table.get("menuText"),
686            "PopupMenu.font", dialogPlain12,
687            "PopupMenu.consumeEventOnClose", Boolean.TRUE,
688
689            "Label.font", dialogPlain12,
690            "Label.background", table.get("control"),
691            "Label.foreground", table.get("controlText"),
692
693            "Separator.shadow", table.get("controlShadow"),          // DEPRECATED - DO NOT USE!
694            "Separator.highlight", table.get("controlLtHighlight"),  // DEPRECATED - DO NOT USE!
695
696            "Separator.background", table.get("controlLtHighlight"),
697            "Separator.foreground", table.get("controlShadow"),
698
699            "List.focusCellHighlightBorder", focusCellHighlightBorder,
700            "List.focusInputMap",
701               new UIDefaults.LazyInputMap(new Object[] {
702                             "COPY", "copy",
703                            "PASTE", "paste",
704                              "CUT", "cut",
705                   "control INSERT", "copy",
706                     "shift INSERT", "paste",
707                     "shift DELETE", "cut",
708                               "UP", "selectPreviousRow",
709                            "KP_UP", "selectPreviousRow",
710                         "shift UP", "selectPreviousRowExtendSelection",
711                      "shift KP_UP", "selectPreviousRowExtendSelection",
712                    "ctrl shift UP", "selectPreviousRowExtendSelection",
713                 "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
714                          "ctrl UP", "selectPreviousRowChangeLead",
715                       "ctrl KP_UP", "selectPreviousRowChangeLead",
716                             "DOWN", "selectNextRow",
717                          "KP_DOWN", "selectNextRow",
718                       "shift DOWN", "selectNextRowExtendSelection",
719                    "shift KP_DOWN", "selectNextRowExtendSelection",
720                  "ctrl shift DOWN", "selectNextRowExtendSelection",
721               "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
722                        "ctrl DOWN", "selectNextRowChangeLead",
723                     "ctrl KP_DOWN", "selectNextRowChangeLead",
724                             "LEFT", "selectPreviousColumn",
725                          "KP_LEFT", "selectPreviousColumn",
726                       "shift LEFT", "selectPreviousColumnExtendSelection",
727                    "shift KP_LEFT", "selectPreviousColumnExtendSelection",
728                  "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
729               "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
730                        "ctrl LEFT", "selectPreviousColumnChangeLead",
731                     "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
732                            "RIGHT", "selectNextColumn",
733                         "KP_RIGHT", "selectNextColumn",
734                      "shift RIGHT", "selectNextColumnExtendSelection",
735                   "shift KP_RIGHT", "selectNextColumnExtendSelection",
736                 "ctrl shift RIGHT", "selectNextColumnExtendSelection",
737              "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
738                       "ctrl RIGHT", "selectNextColumnChangeLead",
739                    "ctrl KP_RIGHT", "selectNextColumnChangeLead",
740                             "HOME", "selectFirstRow",
741                       "shift HOME", "selectFirstRowExtendSelection",
742                  "ctrl shift HOME", "selectFirstRowExtendSelection",
743                        "ctrl HOME", "selectFirstRowChangeLead",
744                              "END", "selectLastRow",
745                        "shift END", "selectLastRowExtendSelection",
746                   "ctrl shift END", "selectLastRowExtendSelection",
747                         "ctrl END", "selectLastRowChangeLead",
748                          "PAGE_UP", "scrollUp",
749                    "shift PAGE_UP", "scrollUpExtendSelection",
750               "ctrl shift PAGE_UP", "scrollUpExtendSelection",
751                     "ctrl PAGE_UP", "scrollUpChangeLead",
752                        "PAGE_DOWN", "scrollDown",
753                  "shift PAGE_DOWN", "scrollDownExtendSelection",
754             "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
755                   "ctrl PAGE_DOWN", "scrollDownChangeLead",
756                           "ctrl A", "selectAll",
757                       "ctrl SLASH", "selectAll",
758                  "ctrl BACK_SLASH", "clearSelection",
759                            "SPACE", "addToSelection",
760                       "ctrl SPACE", "toggleAndAnchor",
761                      "shift SPACE", "extendTo",
762                 "ctrl shift SPACE", "moveSelectionTo"
763                 }),
764
765            "DesktopIcon.icon", SwingUtilities2.makeIcon(getClass(),
766                                                         MotifLookAndFeel.class,
767                                                         "icons/DesktopIcon.gif"),
768            "DesktopIcon.border", null,
769            // These are a little odd, MotifInternalFrameUI isntalls em!
770            "DesktopIcon.windowBindings", new Object[]
771              { "ESCAPE", "hideSystemMenu" },
772
773            "InternalFrame.activeTitleBackground", table.get("activeCaptionBorder"),
774            "InternalFrame.inactiveTitleBackground", table.get("inactiveCaptionBorder"),
775            "InternalFrame.windowBindings", new Object[] {
776                "shift ESCAPE", "showSystemMenu",
777                  "ctrl SPACE", "showSystemMenu",
778                      "ESCAPE", "hideSystemMenu"
779            },
780
781            "ScrollBar.background", scrollBarTrack,
782            "ScrollBar.foreground", table.get("control"),
783            "ScrollBar.track", scrollBarTrack,
784            "ScrollBar.trackHighlight", table.get("controlDkShadow"),
785            "ScrollBar.thumb", table.get("control"),
786            "ScrollBar.thumbHighlight", table.get("controlHighlight"),
787            "ScrollBar.thumbDarkShadow", table.get("controlDkShadow"),
788            "ScrollBar.thumbShadow", table.get("controlShadow"),
789            "ScrollBar.border", loweredBevelBorder,
790            "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
791            "ScrollBar.ancestorInputMap",
792               new UIDefaults.LazyInputMap(new Object[] {
793                       "RIGHT", "positiveUnitIncrement",
794                    "KP_RIGHT", "positiveUnitIncrement",
795                        "DOWN", "positiveUnitIncrement",
796                     "KP_DOWN", "positiveUnitIncrement",
797                   "PAGE_DOWN", "positiveBlockIncrement",
798              "ctrl PAGE_DOWN", "positiveBlockIncrement",
799                        "LEFT", "negativeUnitIncrement",
800                     "KP_LEFT", "negativeUnitIncrement",
801                          "UP", "negativeUnitIncrement",
802                       "KP_UP", "negativeUnitIncrement",
803                     "PAGE_UP", "negativeBlockIncrement",
804                "ctrl PAGE_UP", "negativeBlockIncrement",
805                        "HOME", "minScroll",
806                         "END", "maxScroll"
807                 }),
808
809            "ScrollPane.font", dialogPlain12,
810            "ScrollPane.background", table.get("control"),
811            "ScrollPane.foreground", table.get("controlText"),
812            "ScrollPane.border", null,
813            "ScrollPane.viewportBorder", loweredBevelBorder,
814            "ScrollPane.ancestorInputMap",
815               new UIDefaults.LazyInputMap(new Object[] {
816                           "RIGHT", "unitScrollRight",
817                        "KP_RIGHT", "unitScrollRight",
818                            "DOWN", "unitScrollDown",
819                         "KP_DOWN", "unitScrollDown",
820                            "LEFT", "unitScrollLeft",
821                         "KP_LEFT", "unitScrollLeft",
822                              "UP", "unitScrollUp",
823                           "KP_UP", "unitScrollUp",
824                         "PAGE_UP", "scrollUp",
825                       "PAGE_DOWN", "scrollDown",
826                    "ctrl PAGE_UP", "scrollLeft",
827                  "ctrl PAGE_DOWN", "scrollRight",
828                       "ctrl HOME", "scrollHome",
829                        "ctrl END", "scrollEnd"
830                 }),
831
832            "Slider.font", dialogPlain12,
833            "Slider.border", focusBevelBorder,
834            "Slider.foreground", table.get("control"),
835            "Slider.background", controlDarker,
836            "Slider.highlight", table.get("controlHighlight"),
837            "Slider.shadow", table.get("controlShadow"),
838            "Slider.focus", table.get("controlDkShadow"),
839            "Slider.focusInsets", sliderFocusInsets,
840            "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
841                         "RIGHT", "positiveUnitIncrement",
842                      "KP_RIGHT", "positiveUnitIncrement",
843                          "DOWN", "negativeUnitIncrement",
844                       "KP_DOWN", "negativeUnitIncrement",
845                "ctrl PAGE_DOWN", "negativeBlockIncrement",
846                          "LEFT", "negativeUnitIncrement",
847                       "KP_LEFT", "negativeUnitIncrement",
848                            "UP", "positiveUnitIncrement",
849                         "KP_UP", "positiveUnitIncrement",
850                  "ctrl PAGE_UP", "positiveBlockIncrement",
851                          "HOME", "minScroll",
852                           "END", "maxScroll"
853            }),
854
855            // Spinner
856            "Spinner.ancestorInputMap",
857               new UIDefaults.LazyInputMap(new Object[] {
858                               "UP", "increment",
859                            "KP_UP", "increment",
860                             "DOWN", "decrement",
861                          "KP_DOWN", "decrement",
862               }),
863            "Spinner.border", textFieldBorder,
864
865            "SplitPane.background", table.get("control"),
866            "SplitPane.highlight", table.get("controlHighlight"),
867            "SplitPane.shadow", table.get("controlShadow"),
868            "SplitPane.dividerSize", Integer.valueOf(20),
869            "SplitPane.activeThumb", table.get("activeCaptionBorder"),
870            "SplitPane.ancestorInputMap",
871               new UIDefaults.LazyInputMap(new Object[] {
872                        "UP", "negativeIncrement",
873                      "DOWN", "positiveIncrement",
874                      "LEFT", "negativeIncrement",
875                     "RIGHT", "positiveIncrement",
876                     "KP_UP", "negativeIncrement",
877                   "KP_DOWN", "positiveIncrement",
878                   "KP_LEFT", "negativeIncrement",
879                  "KP_RIGHT", "positiveIncrement",
880                      "HOME", "selectMin",
881                       "END", "selectMax",
882                        "F8", "startResize",
883                        "F6", "toggleFocus",
884                  "ctrl TAB", "focusOutForward",
885            "ctrl shift TAB", "focusOutBackward"
886               }),
887
888            "TabbedPane.font", dialogPlain12,
889            "TabbedPane.background", table.get("control"),
890            "TabbedPane.foreground", table.get("controlText"),
891            "TabbedPane.light", table.get("controlHighlight"),
892            "TabbedPane.highlight", table.get("controlLtHighlight"),
893            "TabbedPane.shadow", table.get("controlShadow"),
894            "TabbedPane.darkShadow", table.get("controlShadow"),
895            "TabbedPane.unselectedTabBackground", unselectedTabBackground,
896            "TabbedPane.unselectedTabForeground", unselectedTabForeground,
897            "TabbedPane.unselectedTabHighlight", unselectedTabHighlight,
898            "TabbedPane.unselectedTabShadow", unselectedTabShadow,
899            "TabbedPane.focus", table.get("activeCaptionBorder"),
900            "TabbedPane.tabInsets", tabbedPaneTabInsets,
901            "TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets,
902            "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
903            "TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets,
904            "TabbedPane.focusInputMap",
905              new UIDefaults.LazyInputMap(new Object[] {
906                         "RIGHT", "navigateRight",
907                      "KP_RIGHT", "navigateRight",
908                          "LEFT", "navigateLeft",
909                       "KP_LEFT", "navigateLeft",
910                            "UP", "navigateUp",
911                         "KP_UP", "navigateUp",
912                          "DOWN", "navigateDown",
913                       "KP_DOWN", "navigateDown",
914                     "ctrl DOWN", "requestFocusForVisibleComponent",
915                  "ctrl KP_DOWN", "requestFocusForVisibleComponent",
916                }),
917            "TabbedPane.ancestorInputMap",
918               new UIDefaults.LazyInputMap(new Object[] {
919                   "ctrl PAGE_DOWN", "navigatePageDown",
920                     "ctrl PAGE_UP", "navigatePageUp",
921                          "ctrl UP", "requestFocus",
922                       "ctrl KP_UP", "requestFocus",
923                 }),
924
925
926            "Tree.background", controlDarker,                              // default: dark slate blue
927            "Tree.hash", table.get("controlDkShadow"),                     // default: black
928            "Tree.iconShadow", table.get("controlShadow"),
929            "Tree.iconHighlight", table.get("controlHighlight"),
930            "Tree.iconBackground", table.get("control"),
931            "Tree.iconForeground", table.get("controlShadow"),             // default: black
932            "Tree.textBackground", controlDarker,             // default: dark slate blue
933            "Tree.textForeground", table.get("textText"),           // default: black
934            "Tree.selectionBackground", table.get("text"),            // default: white
935            "Tree.selectionForeground", table.get("textText"),              // default: black
936            "Tree.selectionBorderColor", table.get("activeCaptionBorder"), // default: maroon
937            "Tree.openIcon", treeOpenIcon,
938            "Tree.closedIcon", treeClosedIcon,
939            "Tree.leafIcon", treeLeafIcon,
940            "Tree.expandedIcon", treeExpandedIcon,
941            "Tree.collapsedIcon", treeCollapsedIcon,
942            "Tree.editorBorder", focusBorder,
943            "Tree.editorBorderSelectionColor", table.get("activeCaptionBorder"),
944            "Tree.rowHeight", 18,
945            "Tree.drawsFocusBorderAroundIcon", Boolean.TRUE,
946            "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
947                                "COPY", "copy",
948                               "PASTE", "paste",
949                                 "CUT", "cut",
950                      "control INSERT", "copy",
951                        "shift INSERT", "paste",
952                        "shift DELETE", "cut",
953                                  "UP", "selectPrevious",
954                               "KP_UP", "selectPrevious",
955                            "shift UP", "selectPreviousExtendSelection",
956                         "shift KP_UP", "selectPreviousExtendSelection",
957                       "ctrl shift UP", "selectPreviousExtendSelection",
958                    "ctrl shift KP_UP", "selectPreviousExtendSelection",
959                             "ctrl UP", "selectPreviousChangeLead",
960                          "ctrl KP_UP", "selectPreviousChangeLead",
961                                "DOWN", "selectNext",
962                             "KP_DOWN", "selectNext",
963                          "shift DOWN", "selectNextExtendSelection",
964                       "shift KP_DOWN", "selectNextExtendSelection",
965                     "ctrl shift DOWN", "selectNextExtendSelection",
966                  "ctrl shift KP_DOWN", "selectNextExtendSelection",
967                           "ctrl DOWN", "selectNextChangeLead",
968                        "ctrl KP_DOWN", "selectNextChangeLead",
969                               "RIGHT", "selectChild",
970                            "KP_RIGHT", "selectChild",
971                                "LEFT", "selectParent",
972                             "KP_LEFT", "selectParent",
973                             "PAGE_UP", "scrollUpChangeSelection",
974                       "shift PAGE_UP", "scrollUpExtendSelection",
975                  "ctrl shift PAGE_UP", "scrollUpExtendSelection",
976                        "ctrl PAGE_UP", "scrollUpChangeLead",
977                           "PAGE_DOWN", "scrollDownChangeSelection",
978                     "shift PAGE_DOWN", "scrollDownExtendSelection",
979                "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
980                      "ctrl PAGE_DOWN", "scrollDownChangeLead",
981                                "HOME", "selectFirst",
982                          "shift HOME", "selectFirstExtendSelection",
983                     "ctrl shift HOME", "selectFirstExtendSelection",
984                           "ctrl HOME", "selectFirstChangeLead",
985                                 "END", "selectLast",
986                           "shift END", "selectLastExtendSelection",
987                      "ctrl shift END", "selectLastExtendSelection",
988                            "ctrl END", "selectLastChangeLead",
989                                  "F2", "startEditing",
990                              "ctrl A", "selectAll",
991                          "ctrl SLASH", "selectAll",
992                     "ctrl BACK_SLASH", "clearSelection",
993                           "ctrl LEFT", "scrollLeft",
994                        "ctrl KP_LEFT", "scrollLeft",
995                          "ctrl RIGHT", "scrollRight",
996                       "ctrl KP_RIGHT", "scrollRight",
997                               "SPACE", "addToSelection",
998                          "ctrl SPACE", "toggleAndAnchor",
999                         "shift SPACE", "extendTo",
1000                    "ctrl shift SPACE", "moveSelectionTo"
1001              }),
1002            "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
1003                "ESCAPE", "cancel" }),
1004
1005            "Table.focusCellHighlightBorder", focusCellHighlightBorder,
1006            "Table.scrollPaneBorder", null,
1007            "Table.dropLineShortColor", table.get("activeCaptionBorder"),
1008
1009            //      "Table.background", white,  // cell background color
1010            "Table.ancestorInputMap",
1011               new UIDefaults.LazyInputMap(new Object[] {
1012                                 "COPY", "copy",
1013                                "PASTE", "paste",
1014                                  "CUT", "cut",
1015                       "control INSERT", "copy",
1016                         "shift INSERT", "paste",
1017                         "shift DELETE", "cut",
1018                                "RIGHT", "selectNextColumn",
1019                             "KP_RIGHT", "selectNextColumn",
1020                          "shift RIGHT", "selectNextColumnExtendSelection",
1021                       "shift KP_RIGHT", "selectNextColumnExtendSelection",
1022                     "ctrl shift RIGHT", "selectNextColumnExtendSelection",
1023                  "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
1024                           "ctrl RIGHT", "selectNextColumnChangeLead",
1025                        "ctrl KP_RIGHT", "selectNextColumnChangeLead",
1026                                 "LEFT", "selectPreviousColumn",
1027                              "KP_LEFT", "selectPreviousColumn",
1028                           "shift LEFT", "selectPreviousColumnExtendSelection",
1029                        "shift KP_LEFT", "selectPreviousColumnExtendSelection",
1030                      "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
1031                   "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
1032                            "ctrl LEFT", "selectPreviousColumnChangeLead",
1033                         "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
1034                                 "DOWN", "selectNextRow",
1035                              "KP_DOWN", "selectNextRow",
1036                           "shift DOWN", "selectNextRowExtendSelection",
1037                        "shift KP_DOWN", "selectNextRowExtendSelection",
1038                      "ctrl shift DOWN", "selectNextRowExtendSelection",
1039                   "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
1040                            "ctrl DOWN", "selectNextRowChangeLead",
1041                         "ctrl KP_DOWN", "selectNextRowChangeLead",
1042                                   "UP", "selectPreviousRow",
1043                                "KP_UP", "selectPreviousRow",
1044                             "shift UP", "selectPreviousRowExtendSelection",
1045                          "shift KP_UP", "selectPreviousRowExtendSelection",
1046                        "ctrl shift UP", "selectPreviousRowExtendSelection",
1047                     "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
1048                              "ctrl UP", "selectPreviousRowChangeLead",
1049                           "ctrl KP_UP", "selectPreviousRowChangeLead",
1050                                 "HOME", "selectFirstColumn",
1051                           "shift HOME", "selectFirstColumnExtendSelection",
1052                      "ctrl shift HOME", "selectFirstRowExtendSelection",
1053                            "ctrl HOME", "selectFirstRow",
1054                                  "END", "selectLastColumn",
1055                            "shift END", "selectLastColumnExtendSelection",
1056                       "ctrl shift END", "selectLastRowExtendSelection",
1057                             "ctrl END", "selectLastRow",
1058                              "PAGE_UP", "scrollUpChangeSelection",
1059                        "shift PAGE_UP", "scrollUpExtendSelection",
1060                   "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
1061                         "ctrl PAGE_UP", "scrollLeftChangeSelection",
1062                            "PAGE_DOWN", "scrollDownChangeSelection",
1063                      "shift PAGE_DOWN", "scrollDownExtendSelection",
1064                 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
1065                       "ctrl PAGE_DOWN", "scrollRightChangeSelection",
1066                                  "TAB", "selectNextColumnCell",
1067                            "shift TAB", "selectPreviousColumnCell",
1068                                "ENTER", "selectNextRowCell",
1069                          "shift ENTER", "selectPreviousRowCell",
1070                               "ctrl A", "selectAll",
1071                           "ctrl SLASH", "selectAll",
1072                      "ctrl BACK_SLASH", "clearSelection",
1073                               "ESCAPE", "cancel",
1074                                   "F2", "startEditing",
1075                                "SPACE", "addToSelection",
1076                           "ctrl SPACE", "toggleAndAnchor",
1077                          "shift SPACE", "extendTo",
1078                     "ctrl shift SPACE", "moveSelectionTo",
1079                                   "F8", "focusHeader"
1080                 }),
1081
1082
1083            "FormattedTextField.focusInputMap",
1084              new UIDefaults.LazyInputMap(new Object[] {
1085                           "ctrl C", DefaultEditorKit.copyAction,
1086                           "ctrl V", DefaultEditorKit.pasteAction,
1087                           "ctrl X", DefaultEditorKit.cutAction,
1088                             "COPY", DefaultEditorKit.copyAction,
1089                            "PASTE", DefaultEditorKit.pasteAction,
1090                              "CUT", DefaultEditorKit.cutAction,
1091                       "shift LEFT", DefaultEditorKit.selectionBackwardAction,
1092                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
1093                      "shift RIGHT", DefaultEditorKit.selectionForwardAction,
1094                   "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
1095                        "ctrl LEFT", DefaultEditorKit.previousWordAction,
1096                     "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
1097                       "ctrl RIGHT", DefaultEditorKit.nextWordAction,
1098                    "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
1099                  "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
1100               "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
1101                 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
1102              "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
1103                           "ctrl A", DefaultEditorKit.selectAllAction,
1104                             "HOME", DefaultEditorKit.beginLineAction,
1105                              "END", DefaultEditorKit.endLineAction,
1106                       "shift HOME", DefaultEditorKit.selectionBeginLineAction,
1107                        "shift END", DefaultEditorKit.selectionEndLineAction,
1108                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
1109                 "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
1110                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
1111                           "DELETE", DefaultEditorKit.deleteNextCharAction,
1112                      "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
1113                  "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
1114                            "RIGHT", DefaultEditorKit.forwardAction,
1115                             "LEFT", DefaultEditorKit.backwardAction,
1116                         "KP_RIGHT", DefaultEditorKit.forwardAction,
1117                          "KP_LEFT", DefaultEditorKit.backwardAction,
1118                            "ENTER", JTextField.notifyAction,
1119                  "ctrl BACK_SLASH", "unselect",
1120                   "control shift O", "toggle-componentOrientation",
1121                           "ESCAPE", "reset-field-edit",
1122                               "UP", "increment",
1123                            "KP_UP", "increment",
1124                             "DOWN", "decrement",
1125                          "KP_DOWN", "decrement",
1126              }),
1127
1128            // ToolBar.
1129            "ToolBar.ancestorInputMap",
1130               new UIDefaults.LazyInputMap(new Object[] {
1131                        "UP", "navigateUp",
1132                     "KP_UP", "navigateUp",
1133                      "DOWN", "navigateDown",
1134                   "KP_DOWN", "navigateDown",
1135                      "LEFT", "navigateLeft",
1136                   "KP_LEFT", "navigateLeft",
1137                     "RIGHT", "navigateRight",
1138                  "KP_RIGHT", "navigateRight"
1139                 }),
1140
1141
1142
1143            "ComboBox.control", table.get("control"),
1144            "ComboBox.controlForeground", black,
1145            "ComboBox.background", table.get("window"),
1146            "ComboBox.foreground", black,
1147            "ComboBox.border", comboBoxBorder,
1148            "ComboBox.selectionBackground", black,
1149            "ComboBox.selectionForeground", table.get("text"),
1150            "ComboBox.disabledBackground", table.get("control"),
1151            "ComboBox.disabledForeground", table.get("textInactiveText"),
1152            "ComboBox.font", dialogPlain12,
1153            "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
1154                   "ESCAPE", "hidePopup",
1155                  "PAGE_UP", "pageUpPassThrough",
1156                "PAGE_DOWN", "pageDownPassThrough",
1157                     "HOME", "homePassThrough",
1158                      "END", "endPassThrough",
1159                     "DOWN", "selectNext",
1160                  "KP_DOWN", "selectNext",
1161                       "UP", "selectPrevious",
1162                    "KP_UP", "selectPrevious",
1163                    "SPACE", "spacePopup",
1164                    "ENTER", "enterPressed"
1165
1166              }),
1167
1168            "TextField.caretForeground", black,
1169            "TextField.caretBlinkRate", Integer.valueOf(500),
1170            "TextField.inactiveForeground", table.get("textInactiveText"),
1171            "TextField.selectionBackground", table.get("textHighlight"),
1172            "TextField.selectionForeground", table.get("textHighlightText"),
1173            "TextField.background", table.get("window"),
1174            "TextField.foreground", table.get("textText"),
1175            "TextField.font", sansSerifPlain12,
1176            "TextField.border", textFieldBorder,
1177            "TextField.focusInputMap", fieldInputMap,
1178
1179            "PasswordField.caretForeground", black,
1180            "PasswordField.caretBlinkRate", Integer.valueOf(500),
1181            "PasswordField.inactiveForeground", table.get("textInactiveText"),
1182            "PasswordField.selectionBackground", table.get("textHighlight"),
1183            "PasswordField.selectionForeground", table.get("textHighlightText"),
1184            "PasswordField.background", table.get("window"),
1185            "PasswordField.foreground", table.get("textText"),
1186            "PasswordField.font", monospacedPlain12,
1187            "PasswordField.border", textFieldBorder,
1188            "PasswordField.focusInputMap", passwordInputMap,
1189
1190            "TextArea.caretForeground", black,
1191            "TextArea.caretBlinkRate", Integer.valueOf(500),
1192            "TextArea.inactiveForeground", table.get("textInactiveText"),
1193            "TextArea.selectionBackground", table.get("textHighlight"),
1194            "TextArea.selectionForeground", table.get("textHighlightText"),
1195            "TextArea.background", table.get("window"),
1196            "TextArea.foreground", table.get("textText"),
1197            "TextArea.font", monospacedPlain12,
1198            "TextArea.border", marginBorder,
1199            "TextArea.focusInputMap", multilineInputMap,
1200
1201            "TextPane.caretForeground", black,
1202            "TextPane.caretBlinkRate", Integer.valueOf(500),
1203            "TextPane.inactiveForeground", table.get("textInactiveText"),
1204            "TextPane.selectionBackground", lightGray,
1205            "TextPane.selectionForeground", table.get("textHighlightText"),
1206            "TextPane.background", white,
1207            "TextPane.foreground", table.get("textText"),
1208            "TextPane.font", serifPlain12,
1209            "TextPane.border", marginBorder,
1210            "TextPane.focusInputMap", multilineInputMap,
1211
1212            "EditorPane.caretForeground", red,
1213            "EditorPane.caretBlinkRate", Integer.valueOf(500),
1214            "EditorPane.inactiveForeground", table.get("textInactiveText"),
1215            "EditorPane.selectionBackground", lightGray,
1216            "EditorPane.selectionForeground", table.get("textHighlightText"),
1217            "EditorPane.background", white,
1218            "EditorPane.foreground", table.get("textText"),
1219            "EditorPane.font", serifPlain12,
1220            "EditorPane.border", marginBorder,
1221            "EditorPane.focusInputMap", multilineInputMap,
1222
1223
1224            "FileChooser.ancestorInputMap",
1225               new UIDefaults.LazyInputMap(new Object[] {
1226                     "ESCAPE", "cancelSelection"
1227                 }),
1228
1229
1230            "ToolTip.border", raisedBevelBorder,
1231            "ToolTip.background", table.get("info"),
1232            "ToolTip.foreground", table.get("infoText"),
1233
1234            // These window InputMap bindings are used when the Menu is
1235            // selected.
1236            "PopupMenu.selectedWindowInputMapBindings", new Object[] {
1237                  "ESCAPE", "cancel",
1238                     "TAB", "cancel",
1239               "shift TAB", "cancel",
1240                    "DOWN", "selectNext",
1241                 "KP_DOWN", "selectNext",
1242                      "UP", "selectPrevious",
1243                   "KP_UP", "selectPrevious",
1244                    "LEFT", "selectParent",
1245                 "KP_LEFT", "selectParent",
1246                   "RIGHT", "selectChild",
1247                "KP_RIGHT", "selectChild",
1248                   "ENTER", "return",
1249                   "ctrl ENTER", "return",
1250                   "SPACE", "return"
1251            },
1252
1253
1254            "OptionPane.border", optionPaneBorder,
1255            "OptionPane.messageAreaBorder", optionPaneMessageAreaBorder,
1256            "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder,
1257            "OptionPane.errorIcon", SwingUtilities2.makeIcon(getClass(),
1258                                                             MotifLookAndFeel.class,
1259                                                             "icons/Error.gif"),
1260            "OptionPane.informationIcon", SwingUtilities2.makeIcon(getClass(),
1261                                                                   MotifLookAndFeel.class,
1262                                                                   "icons/Inform.gif"),
1263            "OptionPane.warningIcon", SwingUtilities2.makeIcon(getClass(),
1264                                                               MotifLookAndFeel.class,
1265                                                               "icons/Warn.gif"),
1266            "OptionPane.questionIcon", SwingUtilities2.makeIcon(getClass(),
1267                                                                MotifLookAndFeel.class,
1268                                                                "icons/Question.gif"),
1269            "OptionPane.windowBindings", new Object[] {
1270                "ESCAPE", "close" },
1271
1272            // These bindings are only enabled when there is a default
1273            // button set on the rootpane.
1274            "RootPane.defaultButtonWindowKeyBindings", new Object[] {
1275                             "ENTER", "press",
1276                    "released ENTER", "release",
1277                        "ctrl ENTER", "press",
1278               "ctrl released ENTER", "release"
1279              },
1280        };
1281
1282        table.putDefaults(defaults);
1283    }
1284
1285}
1286