       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
      26 package com.sun.java.swing.plaf.motif;
      27
      28 import java.awt.Color;
      29 import java.awt.Font;
      30 import java.awt.Insets;
      31 import java.awt.event.KeyEvent;
      32 import java.awt.event.InputEvent;
      33 import java.util.*;
      34
      35 import javax.swing.*;
      36 import javax.swing.plaf.*;
      37 import javax.swing.border.*;
      38 import javax.swing.text.JTextComponent;
      39 import javax.swing.text.DefaultEditorKit;
      40
      41 import javax.swing.plaf.basic.BasicLookAndFeel;
      42 import javax.swing.plaf.basic.BasicBorders;
      43 import javax.swing.plaf.basic.BasicComboBoxRenderer;
      44 import javax.swing.plaf.basic.BasicComboBoxEditor;
      45
      46 import sun.swing.SwingAccessor;
      47 import sun.swing.SwingUtilities2;
      48 import 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
      65 public 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                 SwingUtilities2.getSystemMnemonicKeyMask() |
     641                         InputEvent.ALT_GRAPH_DOWN_MASK
     642             },
     643             "Menu.cancelMode", "hideMenuTree",
     644
     645             "MenuBar.border", menuBarBorder,
     646             "MenuBar.background", table.get("menu"),
     647             "MenuBar.foreground", table.get("menuText"),
     648             "MenuBar.font", dialogPlain12,
     649             "MenuBar.windowBindings", new Object[] {
     650                 "F10", "takeFocus" },
     651
     652             "MenuItem.border", menuMarginBorder,
     653             "MenuItem.font", dialogPlain12,
     654             "MenuItem.acceleratorFont", dialogPlain12,
     655             "MenuItem.acceleratorSelectionForeground", menuItemPressedForeground,
     656             "MenuItem.foreground", table.get("menuText"),
     657             "MenuItem.background", table.get("menu"),
     658             "MenuItem.selectionForeground", menuItemPressedForeground,
     659             "MenuItem.selectionBackground", menuItemPressedBackground,
     660             "MenuItem.checkIcon", menuItemCheckIcon,
     661             "MenuItem.arrowIcon", menuItemArrowIcon,
     662
     663             "RadioButtonMenuItem.border", menuMarginBorder,
     664             "RadioButtonMenuItem.font", dialogPlain12,
     665             "RadioButtonMenuItem.acceleratorFont", dialogPlain12,
     666             "RadioButtonMenuItem.acceleratorSelectionForeground", menuItemPressedForeground,
     667             "RadioButtonMenuItem.foreground", table.get("menuText"),
     668             "RadioButtonMenuItem.background", table.get("menu"),
     669             "RadioButtonMenuItem.selectionForeground", menuItemPressedForeground,
     670             "RadioButtonMenuItem.selectionBackground", menuItemPressedBackground,
     671             "RadioButtonMenuItem.checkIcon", radioButtonIcon,
     672             "RadioButtonMenuItem.arrowIcon", menuItemArrowIcon,
     673
     674             "CheckBoxMenuItem.border", menuMarginBorder,
     675             "CheckBoxMenuItem.font", dialogPlain12,
     676             "CheckBoxMenuItem.acceleratorFont", dialogPlain12,
     677             "CheckBoxMenuItem.acceleratorSelectionForeground", menuItemPressedForeground,
     678             "CheckBoxMenuItem.foreground", table.get("menuText"),
     679             "CheckBoxMenuItem.background", table.get("menu"),
     680             "CheckBoxMenuItem.selectionForeground", menuItemPressedForeground,
     681             "CheckBoxMenuItem.selectionBackground", menuItemPressedBackground,
     682             "CheckBoxMenuItem.checkIcon", checkBoxIcon,
     683             "CheckBoxMenuItem.arrowIcon", menuItemArrowIcon,
     684
     685             "PopupMenu.background", table.get("menu"),
     686             "PopupMenu.border", popupMenuBorder,
     687             "PopupMenu.foreground", table.get("menuText"),
     688             "PopupMenu.font", dialogPlain12,
     689             "PopupMenu.consumeEventOnClose", Boolean.TRUE,
     690
     691             "Label.font", dialogPlain12,
     692             "Label.background", table.get("control"),
     693             "Label.foreground", table.get("controlText"),
     694
     695             "Separator.shadow", table.get("controlShadow"),          // DEPRECATED - DO NOT USE!
     696             "Separator.highlight", table.get("controlLtHighlight"),  // DEPRECATED - DO NOT USE!
     697
     698             "Separator.background", table.get("controlLtHighlight"),
     699             "Separator.foreground", table.get("controlShadow"),
     700
     701             "List.focusCellHighlightBorder", focusCellHighlightBorder,
     702             "List.focusInputMap",
     703                new UIDefaults.LazyInputMap(new Object[] {
     704                              "COPY", "copy",
     705                             "PASTE", "paste",
     706                               "CUT", "cut",
     707                    "control INSERT", "copy",
     708                      "shift INSERT", "paste",
     709                      "shift DELETE", "cut",
     710                                "UP", "selectPreviousRow",
     711                             "KP_UP", "selectPreviousRow",
     712                          "shift UP", "selectPreviousRowExtendSelection",
     713                       "shift KP_UP", "selectPreviousRowExtendSelection",
     714                     "ctrl shift UP", "selectPreviousRowExtendSelection",
     715                  "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
     716                           "ctrl UP", "selectPreviousRowChangeLead",
     717                        "ctrl KP_UP", "selectPreviousRowChangeLead",
     718                              "DOWN", "selectNextRow",
     719                           "KP_DOWN", "selectNextRow",
     720                        "shift DOWN", "selectNextRowExtendSelection",
     721                     "shift KP_DOWN", "selectNextRowExtendSelection",
     722                   "ctrl shift DOWN", "selectNextRowExtendSelection",
     723                "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
     724                         "ctrl DOWN", "selectNextRowChangeLead",
     725                      "ctrl KP_DOWN", "selectNextRowChangeLead",
     726                              "LEFT", "selectPreviousColumn",
     727                           "KP_LEFT", "selectPreviousColumn",
     728                        "shift LEFT", "selectPreviousColumnExtendSelection",
     729                     "shift KP_LEFT", "selectPreviousColumnExtendSelection",
     730                   "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
     731                "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
     732                         "ctrl LEFT", "selectPreviousColumnChangeLead",
     733                      "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
     734                             "RIGHT", "selectNextColumn",
     735                          "KP_RIGHT", "selectNextColumn",
     736                       "shift RIGHT", "selectNextColumnExtendSelection",
     737                    "shift KP_RIGHT", "selectNextColumnExtendSelection",
     738                  "ctrl shift RIGHT", "selectNextColumnExtendSelection",
     739               "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
     740                        "ctrl RIGHT", "selectNextColumnChangeLead",
     741                     "ctrl KP_RIGHT", "selectNextColumnChangeLead",
     742                              "HOME", "selectFirstRow",
     743                        "shift HOME", "selectFirstRowExtendSelection",
     744                   "ctrl shift HOME", "selectFirstRowExtendSelection",
     745                         "ctrl HOME", "selectFirstRowChangeLead",
     746                               "END", "selectLastRow",
     747                         "shift END", "selectLastRowExtendSelection",
     748                    "ctrl shift END", "selectLastRowExtendSelection",
     749                          "ctrl END", "selectLastRowChangeLead",
     750                           "PAGE_UP", "scrollUp",
     751                     "shift PAGE_UP", "scrollUpExtendSelection",
     752                "ctrl shift PAGE_UP", "scrollUpExtendSelection",
     753                      "ctrl PAGE_UP", "scrollUpChangeLead",
     754                         "PAGE_DOWN", "scrollDown",
     755                   "shift PAGE_DOWN", "scrollDownExtendSelection",
     756              "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
     757                    "ctrl PAGE_DOWN", "scrollDownChangeLead",
     758                            "ctrl A", "selectAll",
     759                        "ctrl SLASH", "selectAll",
     760                   "ctrl BACK_SLASH", "clearSelection",
     761                             "SPACE", "addToSelection",
     762                        "ctrl SPACE", "toggleAndAnchor",
     763                       "shift SPACE", "extendTo",
     764                  "ctrl shift SPACE", "moveSelectionTo"
     765                  }),
     766
     767             "DesktopIcon.icon", SwingUtilities2.makeIcon(getClass(),
     768                                                          MotifLookAndFeel.class,
     769                                                          "icons/DesktopIcon.gif"),
     770             "DesktopIcon.border", null,
     771             // These are a little odd, MotifInternalFrameUI isntalls em!
     772             "DesktopIcon.windowBindings", new Object[]
     773               { "ESCAPE", "hideSystemMenu" },
     774
     775             "InternalFrame.activeTitleBackground", table.get("activeCaptionBorder"),
     776             "InternalFrame.inactiveTitleBackground", table.get("inactiveCaptionBorder"),
     777             "InternalFrame.windowBindings", new Object[] {
     778                 "shift ESCAPE", "showSystemMenu",
     779                   "ctrl SPACE", "showSystemMenu",
     780                       "ESCAPE", "hideSystemMenu"
     781             },
     782
     783             "ScrollBar.background", scrollBarTrack,
     784             "ScrollBar.foreground", table.get("control"),
     785             "ScrollBar.track", scrollBarTrack,
     786             "ScrollBar.trackHighlight", table.get("controlDkShadow"),
     787             "ScrollBar.thumb", table.get("control"),
     788             "ScrollBar.thumbHighlight", table.get("controlHighlight"),
     789             "ScrollBar.thumbDarkShadow", table.get("controlDkShadow"),
     790             "ScrollBar.thumbShadow", table.get("controlShadow"),
     791             "ScrollBar.border", loweredBevelBorder,
     792             "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
     793             "ScrollBar.ancestorInputMap",
     794                new UIDefaults.LazyInputMap(new Object[] {
     795                        "RIGHT", "positiveUnitIncrement",
     796                     "KP_RIGHT", "positiveUnitIncrement",
     797                         "DOWN", "positiveUnitIncrement",
     798                      "KP_DOWN", "positiveUnitIncrement",
     799                    "PAGE_DOWN", "positiveBlockIncrement",
     800               "ctrl PAGE_DOWN", "positiveBlockIncrement",
     801                         "LEFT", "negativeUnitIncrement",
     802                      "KP_LEFT", "negativeUnitIncrement",
     803                           "UP", "negativeUnitIncrement",
     804                        "KP_UP", "negativeUnitIncrement",
     805                      "PAGE_UP", "negativeBlockIncrement",
     806                 "ctrl PAGE_UP", "negativeBlockIncrement",
     807                         "HOME", "minScroll",
     808                          "END", "maxScroll"
     809                  }),
     810
     811             "ScrollPane.font", dialogPlain12,
     812             "ScrollPane.background", table.get("control"),
     813             "ScrollPane.foreground", table.get("controlText"),
     814             "ScrollPane.border", null,
     815             "ScrollPane.viewportBorder", loweredBevelBorder,
     816             "ScrollPane.ancestorInputMap",
     817                new UIDefaults.LazyInputMap(new Object[] {
     818                            "RIGHT", "unitScrollRight",
     819                         "KP_RIGHT", "unitScrollRight",
     820                             "DOWN", "unitScrollDown",
     821                          "KP_DOWN", "unitScrollDown",
     822                             "LEFT", "unitScrollLeft",
     823                          "KP_LEFT", "unitScrollLeft",
     824                               "UP", "unitScrollUp",
     825                            "KP_UP", "unitScrollUp",
     826                          "PAGE_UP", "scrollUp",
     827                        "PAGE_DOWN", "scrollDown",
     828                     "ctrl PAGE_UP", "scrollLeft",
     829                   "ctrl PAGE_DOWN", "scrollRight",
     830                        "ctrl HOME", "scrollHome",
     831                         "ctrl END", "scrollEnd"
     832                  }),
     833
     834             "Slider.font", dialogPlain12,
     835             "Slider.border", focusBevelBorder,
     836             "Slider.foreground", table.get("control"),
     837             "Slider.background", controlDarker,
     838             "Slider.highlight", table.get("controlHighlight"),
     839             "Slider.shadow", table.get("controlShadow"),
     840             "Slider.focus", table.get("controlDkShadow"),
     841             "Slider.focusInsets", sliderFocusInsets,
     842             "Slider.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
     843                          "RIGHT", "positiveUnitIncrement",
     844                       "KP_RIGHT", "positiveUnitIncrement",
     845                           "DOWN", "negativeUnitIncrement",
     846                        "KP_DOWN", "negativeUnitIncrement",
     847                 "ctrl PAGE_DOWN", "negativeBlockIncrement",
     848                           "LEFT", "negativeUnitIncrement",
     849                        "KP_LEFT", "negativeUnitIncrement",
     850                             "UP", "positiveUnitIncrement",
     851                          "KP_UP", "positiveUnitIncrement",
     852                   "ctrl PAGE_UP", "positiveBlockIncrement",
     853                           "HOME", "minScroll",
     854                            "END", "maxScroll"
     855             }),
     856
     857             // Spinner
     858             "Spinner.ancestorInputMap",
     859                new UIDefaults.LazyInputMap(new Object[] {
     860                                "UP", "increment",
     861                             "KP_UP", "increment",
     862                              "DOWN", "decrement",
     863                           "KP_DOWN", "decrement",
     864                }),
     865             "Spinner.border", textFieldBorder,
     866
     867             "SplitPane.background", table.get("control"),
     868             "SplitPane.highlight", table.get("controlHighlight"),
     869             "SplitPane.shadow", table.get("controlShadow"),
     870             "SplitPane.dividerSize", Integer.valueOf(20),
     871             "SplitPane.activeThumb", table.get("activeCaptionBorder"),
     872             "SplitPane.ancestorInputMap",
     873                new UIDefaults.LazyInputMap(new Object[] {
     874                         "UP", "negativeIncrement",
     875                       "DOWN", "positiveIncrement",
     876                       "LEFT", "negativeIncrement",
     877                      "RIGHT", "positiveIncrement",
     878                      "KP_UP", "negativeIncrement",
     879                    "KP_DOWN", "positiveIncrement",
     880                    "KP_LEFT", "negativeIncrement",
     881                   "KP_RIGHT", "positiveIncrement",
     882                       "HOME", "selectMin",
     883                        "END", "selectMax",
     884                         "F8", "startResize",
     885                         "F6", "toggleFocus",
     886                   "ctrl TAB", "focusOutForward",
     887             "ctrl shift TAB", "focusOutBackward"
     888                }),
     889
     890             "TabbedPane.font", dialogPlain12,
     891             "TabbedPane.background", table.get("control"),
     892             "TabbedPane.foreground", table.get("controlText"),
     893             "TabbedPane.light", table.get("controlHighlight"),
     894             "TabbedPane.highlight", table.get("controlLtHighlight"),
     895             "TabbedPane.shadow", table.get("controlShadow"),
     896             "TabbedPane.darkShadow", table.get("controlShadow"),
     897             "TabbedPane.unselectedTabBackground", unselectedTabBackground,
     898             "TabbedPane.unselectedTabForeground", unselectedTabForeground,
     899             "TabbedPane.unselectedTabHighlight", unselectedTabHighlight,
     900             "TabbedPane.unselectedTabShadow", unselectedTabShadow,
     901             "TabbedPane.focus", table.get("activeCaptionBorder"),
     902             "TabbedPane.tabInsets", tabbedPaneTabInsets,
     903             "TabbedPane.selectedTabPadInsets", tabbedPaneTabPadInsets,
     904             "TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
     905             "TabbedPane.contentBorderInsets", tabbedPaneContentBorderInsets,
     906             "TabbedPane.focusInputMap",
     907               new UIDefaults.LazyInputMap(new Object[] {
     908                          "RIGHT", "navigateRight",
     909                       "KP_RIGHT", "navigateRight",
     910                           "LEFT", "navigateLeft",
     911                        "KP_LEFT", "navigateLeft",
     912                             "UP", "navigateUp",
     913                          "KP_UP", "navigateUp",
     914                           "DOWN", "navigateDown",
     915                        "KP_DOWN", "navigateDown",
     916                      "ctrl DOWN", "requestFocusForVisibleComponent",
     917                   "ctrl KP_DOWN", "requestFocusForVisibleComponent",
     918                 }),
     919             "TabbedPane.ancestorInputMap",
     920                new UIDefaults.LazyInputMap(new Object[] {
     921                    "ctrl PAGE_DOWN", "navigatePageDown",
     922                      "ctrl PAGE_UP", "navigatePageUp",
     923                           "ctrl UP", "requestFocus",
     924                        "ctrl KP_UP", "requestFocus",
     925                  }),
     926
     927
     928             "Tree.background", controlDarker,                              // default: dark slate blue
     929             "Tree.hash", table.get("controlDkShadow"),                     // default: black
     930             "Tree.iconShadow", table.get("controlShadow"),
     931             "Tree.iconHighlight", table.get("controlHighlight"),
     932             "Tree.iconBackground", table.get("control"),
     933             "Tree.iconForeground", table.get("controlShadow"),             // default: black
     934             "Tree.textBackground", controlDarker,             // default: dark slate blue
     935             "Tree.textForeground", table.get("textText"),           // default: black
     936             "Tree.selectionBackground", table.get("text"),            // default: white
     937             "Tree.selectionForeground", table.get("textText"),              // default: black
     938             "Tree.selectionBorderColor", table.get("activeCaptionBorder"), // default: maroon
     939             "Tree.openIcon", treeOpenIcon,
     940             "Tree.closedIcon", treeClosedIcon,
     941             "Tree.leafIcon", treeLeafIcon,
     942             "Tree.expandedIcon", treeExpandedIcon,
     943             "Tree.collapsedIcon", treeCollapsedIcon,
     944             "Tree.editorBorder", focusBorder,
     945             "Tree.editorBorderSelectionColor", table.get("activeCaptionBorder"),
     946             "Tree.rowHeight", 18,
     947             "Tree.drawsFocusBorderAroundIcon", Boolean.TRUE,
     948             "Tree.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
     949                                 "COPY", "copy",
     950                                "PASTE", "paste",
     951                                  "CUT", "cut",
     952                       "control INSERT", "copy",
     953                         "shift INSERT", "paste",
     954                         "shift DELETE", "cut",
     955                                   "UP", "selectPrevious",
     956                                "KP_UP", "selectPrevious",
     957                             "shift UP", "selectPreviousExtendSelection",
     958                          "shift KP_UP", "selectPreviousExtendSelection",
     959                        "ctrl shift UP", "selectPreviousExtendSelection",
     960                     "ctrl shift KP_UP", "selectPreviousExtendSelection",
     961                              "ctrl UP", "selectPreviousChangeLead",
     962                           "ctrl KP_UP", "selectPreviousChangeLead",
     963                                 "DOWN", "selectNext",
     964                              "KP_DOWN", "selectNext",
     965                           "shift DOWN", "selectNextExtendSelection",
     966                        "shift KP_DOWN", "selectNextExtendSelection",
     967                      "ctrl shift DOWN", "selectNextExtendSelection",
     968                   "ctrl shift KP_DOWN", "selectNextExtendSelection",
     969                            "ctrl DOWN", "selectNextChangeLead",
     970                         "ctrl KP_DOWN", "selectNextChangeLead",
     971                                "RIGHT", "selectChild",
     972                             "KP_RIGHT", "selectChild",
     973                                 "LEFT", "selectParent",
     974                              "KP_LEFT", "selectParent",
     975                              "PAGE_UP", "scrollUpChangeSelection",
     976                        "shift PAGE_UP", "scrollUpExtendSelection",
     977                   "ctrl shift PAGE_UP", "scrollUpExtendSelection",
     978                         "ctrl PAGE_UP", "scrollUpChangeLead",
     979                            "PAGE_DOWN", "scrollDownChangeSelection",
     980                      "shift PAGE_DOWN", "scrollDownExtendSelection",
     981                 "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
     982                       "ctrl PAGE_DOWN", "scrollDownChangeLead",
     983                                 "HOME", "selectFirst",
     984                           "shift HOME", "selectFirstExtendSelection",
     985                      "ctrl shift HOME", "selectFirstExtendSelection",
     986                            "ctrl HOME", "selectFirstChangeLead",
     987                                  "END", "selectLast",
     988                            "shift END", "selectLastExtendSelection",
     989                       "ctrl shift END", "selectLastExtendSelection",
     990                             "ctrl END", "selectLastChangeLead",
     991                                   "F2", "startEditing",
     992                               "ctrl A", "selectAll",
     993                           "ctrl SLASH", "selectAll",
     994                      "ctrl BACK_SLASH", "clearSelection",
     995                            "ctrl LEFT", "scrollLeft",
     996                         "ctrl KP_LEFT", "scrollLeft",
     997                           "ctrl RIGHT", "scrollRight",
     998                        "ctrl KP_RIGHT", "scrollRight",
     999                                "SPACE", "addToSelection",
    1000                           "ctrl SPACE", "toggleAndAnchor",
    1001                          "shift SPACE", "extendTo",
    1002                     "ctrl shift SPACE", "moveSelectionTo"
    1003               }),
    1004             "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
    1005                 "ESCAPE", "cancel" }),
    1006
    1007             "Table.focusCellHighlightBorder", focusCellHighlightBorder,
    1008             "Table.scrollPaneBorder", null,
    1009             "Table.dropLineShortColor", table.get("activeCaptionBorder"),
    1010
    1011             //      "Table.background", white,  // cell background color
    1012             "Table.ancestorInputMap",
    1013                new UIDefaults.LazyInputMap(new Object[] {
    1014                                  "COPY", "copy",
    1015                                 "PASTE", "paste",
    1016                                   "CUT", "cut",
    1017                        "control INSERT", "copy",
    1018                          "shift INSERT", "paste",
    1019                          "shift DELETE", "cut",
    1020                                 "RIGHT", "selectNextColumn",
    1021                              "KP_RIGHT", "selectNextColumn",
    1022                           "shift RIGHT", "selectNextColumnExtendSelection",
    1023                        "shift KP_RIGHT", "selectNextColumnExtendSelection",
    1024                      "ctrl shift RIGHT", "selectNextColumnExtendSelection",
    1025                   "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
    1026                            "ctrl RIGHT", "selectNextColumnChangeLead",
    1027                         "ctrl KP_RIGHT", "selectNextColumnChangeLead",
    1028                                  "LEFT", "selectPreviousColumn",
    1029                               "KP_LEFT", "selectPreviousColumn",
    1030                            "shift LEFT", "selectPreviousColumnExtendSelection",
    1031                         "shift KP_LEFT", "selectPreviousColumnExtendSelection",
    1032                       "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
    1033                    "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
    1034                             "ctrl LEFT", "selectPreviousColumnChangeLead",
    1035                          "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
    1036                                  "DOWN", "selectNextRow",
    1037                               "KP_DOWN", "selectNextRow",
    1038                            "shift DOWN", "selectNextRowExtendSelection",
    1039                         "shift KP_DOWN", "selectNextRowExtendSelection",
    1040                       "ctrl shift DOWN", "selectNextRowExtendSelection",
    1041                    "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
    1042                             "ctrl DOWN", "selectNextRowChangeLead",
    1043                          "ctrl KP_DOWN", "selectNextRowChangeLead",
    1044                                    "UP", "selectPreviousRow",
    1045                                 "KP_UP", "selectPreviousRow",
    1046                              "shift UP", "selectPreviousRowExtendSelection",
    1047                           "shift KP_UP", "selectPreviousRowExtendSelection",
    1048                         "ctrl shift UP", "selectPreviousRowExtendSelection",
    1049                      "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
    1050                               "ctrl UP", "selectPreviousRowChangeLead",
    1051                            "ctrl KP_UP", "selectPreviousRowChangeLead",
    1052                                  "HOME", "selectFirstColumn",
    1053                            "shift HOME", "selectFirstColumnExtendSelection",
    1054                       "ctrl shift HOME", "selectFirstRowExtendSelection",
    1055                             "ctrl HOME", "selectFirstRow",
    1056                                   "END", "selectLastColumn",
    1057                             "shift END", "selectLastColumnExtendSelection",
    1058                        "ctrl shift END", "selectLastRowExtendSelection",
    1059                              "ctrl END", "selectLastRow",
    1060                               "PAGE_UP", "scrollUpChangeSelection",
    1061                         "shift PAGE_UP", "scrollUpExtendSelection",
    1062                    "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
    1063                          "ctrl PAGE_UP", "scrollLeftChangeSelection",
    1064                             "PAGE_DOWN", "scrollDownChangeSelection",
    1065                       "shift PAGE_DOWN", "scrollDownExtendSelection",
    1066                  "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
    1067                        "ctrl PAGE_DOWN", "scrollRightChangeSelection",
    1068                                   "TAB", "selectNextColumnCell",
    1069                             "shift TAB", "selectPreviousColumnCell",
    1070                                 "ENTER", "selectNextRowCell",
    1071                           "shift ENTER", "selectPreviousRowCell",
    1072                                "ctrl A", "selectAll",
    1073                            "ctrl SLASH", "selectAll",
    1074                       "ctrl BACK_SLASH", "clearSelection",
    1075                                "ESCAPE", "cancel",
    1076                                    "F2", "startEditing",
    1077                                 "SPACE", "addToSelection",
    1078                            "ctrl SPACE", "toggleAndAnchor",
    1079                           "shift SPACE", "extendTo",
    1080                      "ctrl shift SPACE", "moveSelectionTo",
    1081                                    "F8", "focusHeader"
    1082                  }),
    1083
    1084
    1085             "FormattedTextField.focusInputMap",
    1086               new UIDefaults.LazyInputMap(new Object[] {
    1087                            "ctrl C", DefaultEditorKit.copyAction,
    1088                            "ctrl V", DefaultEditorKit.pasteAction,
    1089                            "ctrl X", DefaultEditorKit.cutAction,
    1090                              "COPY", DefaultEditorKit.copyAction,
    1091                             "PASTE", DefaultEditorKit.pasteAction,
    1092                               "CUT", DefaultEditorKit.cutAction,
    1093                        "shift LEFT", DefaultEditorKit.selectionBackwardAction,
    1094                     "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
    1095                       "shift RIGHT", DefaultEditorKit.selectionForwardAction,
    1096                    "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
    1097                         "ctrl LEFT", DefaultEditorKit.previousWordAction,
    1098                      "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
    1099                        "ctrl RIGHT", DefaultEditorKit.nextWordAction,
    1100                     "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
    1101                   "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
    1102                "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
    1103                  "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
    1104               "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
    1105                            "ctrl A", DefaultEditorKit.selectAllAction,
    1106                              "HOME", DefaultEditorKit.beginLineAction,
    1107                               "END", DefaultEditorKit.endLineAction,
    1108                        "shift HOME", DefaultEditorKit.selectionBeginLineAction,
    1109                         "shift END", DefaultEditorKit.selectionEndLineAction,
    1110                        "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
    1111                  "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
    1112                            "ctrl H", DefaultEditorKit.deletePrevCharAction,
    1113                            "DELETE", DefaultEditorKit.deleteNextCharAction,
    1114                       "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
    1115                   "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
    1116                             "RIGHT", DefaultEditorKit.forwardAction,
    1117                              "LEFT", DefaultEditorKit.backwardAction,
    1118                          "KP_RIGHT", DefaultEditorKit.forwardAction,
    1119                           "KP_LEFT", DefaultEditorKit.backwardAction,
    1120                             "ENTER", JTextField.notifyAction,
    1121                   "ctrl BACK_SLASH", "unselect",
    1122                    "control shift O", "toggle-componentOrientation",
    1123                            "ESCAPE", "reset-field-edit",
    1124                                "UP", "increment",
    1125                             "KP_UP", "increment",
    1126                              "DOWN", "decrement",
    1127                           "KP_DOWN", "decrement",
    1128               }),
    1129
    1130             // ToolBar.
    1131             "ToolBar.ancestorInputMap",
    1132                new UIDefaults.LazyInputMap(new Object[] {
    1133                         "UP", "navigateUp",
    1134                      "KP_UP", "navigateUp",
    1135                       "DOWN", "navigateDown",
    1136                    "KP_DOWN", "navigateDown",
    1137                       "LEFT", "navigateLeft",
    1138                    "KP_LEFT", "navigateLeft",
    1139                      "RIGHT", "navigateRight",
    1140                   "KP_RIGHT", "navigateRight"
    1141                  }),
    1142
    1143
    1144
    1145             "ComboBox.control", table.get("control"),
    1146             "ComboBox.controlForeground", black,
    1147             "ComboBox.background", table.get("window"),
    1148             "ComboBox.foreground", black,
    1149             "ComboBox.border", comboBoxBorder,
    1150             "ComboBox.selectionBackground", black,
    1151             "ComboBox.selectionForeground", table.get("text"),
    1152             "ComboBox.disabledBackground", table.get("control"),
    1153             "ComboBox.disabledForeground", table.get("textInactiveText"),
    1154             "ComboBox.font", dialogPlain12,
    1155             "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
    1156                    "ESCAPE", "hidePopup",
    1157                   "PAGE_UP", "pageUpPassThrough",
    1158                 "PAGE_DOWN", "pageDownPassThrough",
    1159                      "HOME", "homePassThrough",
    1160                       "END", "endPassThrough",
    1161                      "DOWN", "selectNext",
    1162                   "KP_DOWN", "selectNext",
    1163                        "UP", "selectPrevious",
    1164                     "KP_UP", "selectPrevious",
    1165                     "SPACE", "spacePopup",
    1166                     "ENTER", "enterPressed"
    1167
    1168               }),
    1169
    1170             "TextField.caretForeground", black,
    1171             "TextField.caretBlinkRate", Integer.valueOf(500),
    1172             "TextField.inactiveForeground", table.get("textInactiveText"),
    1173             "TextField.selectionBackground", table.get("textHighlight"),
    1174             "TextField.selectionForeground", table.get("textHighlightText"),
    1175             "TextField.background", table.get("window"),
    1176             "TextField.foreground", table.get("textText"),
    1177             "TextField.font", sansSerifPlain12,
    1178             "TextField.border", textFieldBorder,
    1179             "TextField.focusInputMap", fieldInputMap,
    1180
    1181             "PasswordField.caretForeground", black,
    1182             "PasswordField.caretBlinkRate", Integer.valueOf(500),
    1183             "PasswordField.inactiveForeground", table.get("textInactiveText"),
    1184             "PasswordField.selectionBackground", table.get("textHighlight"),
    1185             "PasswordField.selectionForeground", table.get("textHighlightText"),
    1186             "PasswordField.background", table.get("window"),
    1187             "PasswordField.foreground", table.get("textText"),
    1188             "PasswordField.font", monospacedPlain12,
    1189             "PasswordField.border", textFieldBorder,
    1190             "PasswordField.focusInputMap", passwordInputMap,
    1191
    1192             "TextArea.caretForeground", black,
    1193             "TextArea.caretBlinkRate", Integer.valueOf(500),
    1194             "TextArea.inactiveForeground", table.get("textInactiveText"),
    1195             "TextArea.selectionBackground", table.get("textHighlight"),
    1196             "TextArea.selectionForeground", table.get("textHighlightText"),
    1197             "TextArea.background", table.get("window"),
    1198             "TextArea.foreground", table.get("textText"),
    1199             "TextArea.font", monospacedPlain12,
    1200             "TextArea.border", marginBorder,
    1201             "TextArea.focusInputMap", multilineInputMap,
    1202
    1203             "TextPane.caretForeground", black,
    1204             "TextPane.caretBlinkRate", Integer.valueOf(500),
    1205             "TextPane.inactiveForeground", table.get("textInactiveText"),
    1206             "TextPane.selectionBackground", lightGray,
    1207             "TextPane.selectionForeground", table.get("textHighlightText"),
    1208             "TextPane.background", white,
    1209             "TextPane.foreground", table.get("textText"),
    1210             "TextPane.font", serifPlain12,
    1211             "TextPane.border", marginBorder,
    1212             "TextPane.focusInputMap", multilineInputMap,
    1213
    1214             "EditorPane.caretForeground", red,
    1215             "EditorPane.caretBlinkRate", Integer.valueOf(500),
    1216             "EditorPane.inactiveForeground", table.get("textInactiveText"),
    1217             "EditorPane.selectionBackground", lightGray,
    1218             "EditorPane.selectionForeground", table.get("textHighlightText"),
    1219             "EditorPane.background", white,
    1220             "EditorPane.foreground", table.get("textText"),
    1221             "EditorPane.font", serifPlain12,
    1222             "EditorPane.border", marginBorder,
    1223             "EditorPane.focusInputMap", multilineInputMap,
    1224
    1225
    1226             "FileChooser.ancestorInputMap",
    1227                new UIDefaults.LazyInputMap(new Object[] {
    1228                      "ESCAPE", "cancelSelection"
    1229                  }),
    1230
    1231
    1232             "ToolTip.border", raisedBevelBorder,
    1233             "ToolTip.background", table.get("info"),
    1234             "ToolTip.foreground", table.get("infoText"),
    1235
    1236             // These window InputMap bindings are used when the Menu is
    1237             // selected.
    1238             "PopupMenu.selectedWindowInputMapBindings", new Object[] {
    1239                   "ESCAPE", "cancel",
    1240                      "TAB", "cancel",
    1241                "shift TAB", "cancel",
    1242                     "DOWN", "selectNext",
    1243                  "KP_DOWN", "selectNext",
    1244                       "UP", "selectPrevious",
    1245                    "KP_UP", "selectPrevious",
    1246                     "LEFT", "selectParent",
    1247                  "KP_LEFT", "selectParent",
    1248                    "RIGHT", "selectChild",
    1249                 "KP_RIGHT", "selectChild",
    1250                    "ENTER", "return",
    1251                    "ctrl ENTER", "return",
    1252                    "SPACE", "return"
    1253             },
    1254
    1255
    1256             "OptionPane.border", optionPaneBorder,
    1257             "OptionPane.messageAreaBorder", optionPaneMessageAreaBorder,
    1258             "OptionPane.buttonAreaBorder", optionPaneButtonAreaBorder,
    1259             "OptionPane.errorIcon", SwingUtilities2.makeIcon(getClass(),
    1260                                                              MotifLookAndFeel.class,
    1261                                                              "icons/Error.gif"),
    1262             "OptionPane.informationIcon", SwingUtilities2.makeIcon(getClass(),
    1263                                                                    MotifLookAndFeel.class,
    1264                                                                    "icons/Inform.gif"),
    1265             "OptionPane.warningIcon", SwingUtilities2.makeIcon(getClass(),
    1266                                                                MotifLookAndFeel.class,
    1267                                                                "icons/Warn.gif"),
    1268             "OptionPane.questionIcon", SwingUtilities2.makeIcon(getClass(),
    1269                                                                 MotifLookAndFeel.class,
    1270                                                                 "icons/Question.gif"),
    1271             "OptionPane.windowBindings", new Object[] {
    1272                 "ESCAPE", "close" },
    1273
    1274             // These bindings are only enabled when there is a default
    1275             // button set on the rootpane.
    1276             "RootPane.defaultButtonWindowKeyBindings", new Object[] {
    1277                              "ENTER", "press",
    1278                     "released ENTER", "release",
    1279                         "ctrl ENTER", "press",
    1280                "ctrl released ENTER", "release"
    1281               },
    1282         };
    1283
    1284         table.putDefaults(defaults);
    1285     }
    1286
    1287 }