jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 15315 9db01c15ae0c
child 23010 6dadb192ad81
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
13779
011727a60840 6994562: Swing classes (both JTextArea and JTextField) don't support caret width tuning
VKARNAUK
parents: 11975
diff changeset
     2
 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3932
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3932
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3932
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3932
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3932
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * <p>These classes are designed to be used while the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * corresponding <code>LookAndFeel</code> class has been installed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * (<code>UIManager.setLookAndFeel(new <i>XXX</i>LookAndFeel())</code>).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * Using them while a different <code>LookAndFeel</code> is installed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * may produce unexpected results, including exceptions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Additionally, changing the <code>LookAndFeel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * maintained by the <code>UIManager</code> without updating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * corresponding <code>ComponentUI</code> of any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <code>JComponent</code>s may also produce unexpected results,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * such as the wrong colors showing up, and is generally not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * encouraged.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
package com.sun.java.swing.plaf.windows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.awt.image.BufferedImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import java.awt.image.ImageFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import java.awt.image.ImageProducer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import java.awt.image.FilteredImageSource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import java.awt.image.RGBImageFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
import javax.swing.plaf.basic.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
import javax.swing.border.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
import javax.swing.text.DefaultEditorKit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
import java.awt.Font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
import java.awt.Color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
import java.awt.event.ActionEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
import sun.awt.SunToolkit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
import sun.awt.OSInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
import sun.awt.shell.ShellFolder;
3928
be186a33df9b 6795908: Refactor FontManager
rkennke
parents: 2658
diff changeset
    65
import sun.font.FontUtilities;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
import sun.security.action.GetPropertyAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
import sun.swing.DefaultLayoutStyle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
import sun.swing.ImageIconUIResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
import sun.swing.SwingLazyValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
import sun.swing.SwingUtilities2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
import sun.swing.StringUIClientPropertyKey;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
import static com.sun.java.swing.plaf.windows.TMSchema.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
import com.sun.java.swing.plaf.windows.WindowsIconFactory.VistaMenuItemCheckIconFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * Implements the Windows95/98/NT/2000 Look and Feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * UI classes not implemented specifically for Windows will
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * default to those implemented in Basic.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * future Swing releases.  The current serialization support is appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * for short term storage or RMI between applications running the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * version of Swing.  A future release of Swing will provide support for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * long term persistence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * @author unattributed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
public class WindowsLookAndFeel extends BasicLookAndFeel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * A client property that can be used with any JComponent that will end up
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * calling the LookAndFeel.getDisabledIcon method. This client property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * when set to Boolean.TRUE, will cause getDisabledIcon to use an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * alternate algorithm for creating disabled icons to produce icons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * that appear similar to the native Windows file chooser
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    static final Object HI_RES_DISABLED_ICON_CLIENT_KEY =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        new StringUIClientPropertyKey(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            "WindowsLookAndFeel.generateHiResDisabledIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    private boolean updatePending = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    private boolean useSystemFontSettings = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    private boolean useSystemFontSizeSettings;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    // These properties are not used directly, but are kept as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    // private members to avoid being GC'd.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    private DesktopProperty themeActive, dllName, colorName, sizeName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    private DesktopProperty aaSettings;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    private transient LayoutStyle style;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Base dialog units along the horizontal axis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    private int baseUnitX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * Base dialog units along the vertical axis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    private int baseUnitY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    public String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        return "Windows";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    public String getDescription() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        return "The Microsoft Windows Look and Feel";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    public String getID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        return "Windows";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    public boolean isNativeLookAndFeel() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        return OSInfo.getOSType() == OSInfo.OSType.WINDOWS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    public boolean isSupportedLookAndFeel() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        return isNativeLookAndFeel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    public void initialize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        super.initialize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        // Set the flag which determines which version of Windows should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        // be rendered. This flag only need to be set once.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        // if version <= 4.0 then the classic LAF should be loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        if (OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_95) <= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            isClassicWindows = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            isClassicWindows = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            XPStyle.invalidateStyle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        // Using the fonts set by the user can potentially cause
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        // performance and compatibility issues, so allow this feature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        // to be switched off either at runtime or programmatically
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        String systemFonts = java.security.AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
               new GetPropertyAction("swing.useSystemFontSettings"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        useSystemFontSettings = (systemFonts == null ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                                 Boolean.valueOf(systemFonts).booleanValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        if (useSystemFontSettings) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            Object value = UIManager.get("Application.useSystemFontSettings");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            useSystemFontSettings = (value == null ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                                     Boolean.TRUE.equals(value));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        KeyboardFocusManager.getCurrentKeyboardFocusManager().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            addKeyEventPostProcessor(WindowsRootPaneUI.altProcessor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * Initialize the uiClassID to BasicComponentUI mapping.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * The JComponent classes define their own uiClassID constants
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * (see AbstractComponent.getUIClassID).  This table must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * map those constants to a BasicComponentUI class of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * appropriate type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @see BasicLookAndFeel#getDefaults
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    protected void initClassDefaults(UIDefaults table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        super.initClassDefaults(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        final String windowsPackageName = "com.sun.java.swing.plaf.windows.";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        Object[] uiDefaults = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
              "ButtonUI", windowsPackageName + "WindowsButtonUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            "CheckBoxUI", windowsPackageName + "WindowsCheckBoxUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    "CheckBoxMenuItemUI", windowsPackageName + "WindowsCheckBoxMenuItemUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
               "LabelUI", windowsPackageName + "WindowsLabelUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
         "RadioButtonUI", windowsPackageName + "WindowsRadioButtonUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 "RadioButtonMenuItemUI", windowsPackageName + "WindowsRadioButtonMenuItemUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        "ToggleButtonUI", windowsPackageName + "WindowsToggleButtonUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
         "ProgressBarUI", windowsPackageName + "WindowsProgressBarUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
              "SliderUI", windowsPackageName + "WindowsSliderUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
           "SeparatorUI", windowsPackageName + "WindowsSeparatorUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
           "SplitPaneUI", windowsPackageName + "WindowsSplitPaneUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
             "SpinnerUI", windowsPackageName + "WindowsSpinnerUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
          "TabbedPaneUI", windowsPackageName + "WindowsTabbedPaneUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            "TextAreaUI", windowsPackageName + "WindowsTextAreaUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
           "TextFieldUI", windowsPackageName + "WindowsTextFieldUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
       "PasswordFieldUI", windowsPackageName + "WindowsPasswordFieldUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            "TextPaneUI", windowsPackageName + "WindowsTextPaneUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
          "EditorPaneUI", windowsPackageName + "WindowsEditorPaneUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                "TreeUI", windowsPackageName + "WindowsTreeUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
             "ToolBarUI", windowsPackageName + "WindowsToolBarUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    "ToolBarSeparatorUI", windowsPackageName + "WindowsToolBarSeparatorUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            "ComboBoxUI", windowsPackageName + "WindowsComboBoxUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
         "TableHeaderUI", windowsPackageName + "WindowsTableHeaderUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
       "InternalFrameUI", windowsPackageName + "WindowsInternalFrameUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
         "DesktopPaneUI", windowsPackageName + "WindowsDesktopPaneUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
         "DesktopIconUI", windowsPackageName + "WindowsDesktopIconUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
         "FileChooserUI", windowsPackageName + "WindowsFileChooserUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                "MenuUI", windowsPackageName + "WindowsMenuUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            "MenuItemUI", windowsPackageName + "WindowsMenuItemUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
             "MenuBarUI", windowsPackageName + "WindowsMenuBarUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
           "PopupMenuUI", windowsPackageName + "WindowsPopupMenuUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
  "PopupMenuSeparatorUI", windowsPackageName + "WindowsPopupMenuSeparatorUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
           "ScrollBarUI", windowsPackageName + "WindowsScrollBarUI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            "RootPaneUI", windowsPackageName + "WindowsRootPaneUI"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        table.putDefaults(uiDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * Load the SystemColors into the defaults table.  The keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * for SystemColor defaults are the same as the names of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * the public fields in SystemColor.  If the table is being
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * created on a native Windows platform we use the SystemColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * values, otherwise we create color objects whose values match
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * the defaults Windows95 colors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    protected void initSystemColorDefaults(UIDefaults table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        String[] defaultSystemColors = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                "desktop", "#005C5C", /* Color of the desktop background */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
          "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
      "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
        "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
  "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                 "window", "#FFFFFF", /* Default color for the interior of windows */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
           "windowBorder", "#000000", /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
             "windowText", "#000000", /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                   "menu", "#C0C0C0", /* Background color for menus */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
       "menuPressedItemB", "#000080", /* LightShadow of menubutton highlight */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
       "menuPressedItemF", "#FFFFFF", /* Default color for foreground "text" in menu item */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
               "menuText", "#000000", /* Text color for menus  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                   "text", "#C0C0C0", /* Text background color */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
               "textText", "#000000", /* Text foreground color */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
          "textHighlight", "#000080", /* Text background color when selected */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
      "textHighlightText", "#FFFFFF", /* Text color when selected */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
       "textInactiveText", "#808080", /* Text color when disabled */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
            "controlText", "#000000", /* Default color for text in controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
       "controlHighlight", "#C0C0C0",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
  /*"controlHighlight", "#E0E0E0",*/ /* Specular highlight (opposite of the shadow) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
          "controlShadow", "#808080", /* Shadow color for controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        "controlDkShadow", "#000000", /* Dark shadow color for controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
              "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                   "info", "#FFFFE1", /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
               "infoText", "#000000"  /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * Initialize the defaults table with the name of the ResourceBundle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * used for getting localized defaults.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    private void initResourceBundle(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        table.addResourceBundle( "com.sun.java.swing.plaf.windows.resources.windows" );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    // XXX - there are probably a lot of redundant values that could be removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    // ie. Take a look at RadioButtonBorder, etc...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    protected void initComponentDefaults(UIDefaults table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        super.initComponentDefaults( table );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        initResourceBundle(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        // *** Shared Fonts
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   299
        Integer twelve = Integer.valueOf(12);
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   300
        Integer fontPlain = Integer.valueOf(Font.PLAIN);
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   301
        Integer fontBold = Integer.valueOf(Font.BOLD);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        Object dialogPlain12 = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                               "javax.swing.plaf.FontUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                               null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                               new Object[] {Font.DIALOG, fontPlain, twelve});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        Object sansSerifPlain12 =  new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                          "javax.swing.plaf.FontUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                          null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                          new Object[] {Font.SANS_SERIF, fontPlain, twelve});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        Object monospacedPlain12 = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                          "javax.swing.plaf.FontUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                          null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                          new Object[] {Font.MONOSPACED, fontPlain, twelve});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        Object dialogBold12 = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                          "javax.swing.plaf.FontUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                          null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                          new Object[] {Font.DIALOG, fontBold, twelve});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        // *** Colors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        // XXX - some of these doens't seem to be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        ColorUIResource red = new ColorUIResource(Color.red);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        ColorUIResource black = new ColorUIResource(Color.black);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
        ColorUIResource white = new ColorUIResource(Color.white);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        ColorUIResource gray = new ColorUIResource(Color.gray);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        ColorUIResource darkGray = new ColorUIResource(Color.darkGray);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        ColorUIResource scrollBarTrackHighlight = darkGray;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        // Set the flag which determines which version of Windows should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        // be rendered. This flag only need to be set once.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        // if version <= 4.0 then the classic LAF should be loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        isClassicWindows = OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_95) <= 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        // *** Tree
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        Object treeExpandedIcon = WindowsTreeUI.ExpandedIcon.createExpandedIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        Object treeCollapsedIcon = WindowsTreeUI.CollapsedIcon.createCollapsedIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        // *** Text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                      "control C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                      "control V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                      "control X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
                           "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                          "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                            "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                 "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                   "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                   "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                      "control A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
             "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
                     "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
                    "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                   "control LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                  "control RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
             "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
            "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
                           "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                            "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                     "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
                      "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
                     "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
               "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
                         "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                         "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                    "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
                "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                          "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                           "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                       "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                        "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                          "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        Object passwordInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                      "control C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                      "control V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                      "control X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
                           "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
                          "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                            "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                 "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
                   "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
                   "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
                      "control A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
             "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
                     "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
                    "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
                   "control LEFT", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
                  "control RIGHT", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
             "control shift LEFT", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            "control shift RIGHT", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                           "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                            "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                     "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                      "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                     "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
               "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
                         "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
                         "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
                          "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
                           "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
                       "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
                        "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
                          "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
                      "control C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                      "control V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
                      "control X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
                           "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                          "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                            "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                 "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                   "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                   "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                     "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
                    "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
                   "control LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                  "control RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
             "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                      "control A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
             "control BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                           "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                            "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                     "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
                      "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                   "control HOME", DefaultEditorKit.beginAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                    "control END", DefaultEditorKit.endAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
             "control shift HOME", DefaultEditorKit.selectionBeginAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
              "control shift END", DefaultEditorKit.selectionEndAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                             "UP", DefaultEditorKit.upAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                           "DOWN", DefaultEditorKit.downAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                     "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
               "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                         "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                         "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
                    "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                          "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
                           "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                       "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                        "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                        "PAGE_UP", DefaultEditorKit.pageUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
                      "PAGE_DOWN", DefaultEditorKit.pageDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
                  "shift PAGE_UP", "selection-page-up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
                "shift PAGE_DOWN", "selection-page-down",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
             "ctrl shift PAGE_UP", "selection-page-left",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
           "ctrl shift PAGE_DOWN", "selection-page-right",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                       "shift UP", DefaultEditorKit.selectionUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                     "shift DOWN", DefaultEditorKit.selectionDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                          "ENTER", DefaultEditorKit.insertBreakAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                            "TAB", DefaultEditorKit.insertTabAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
                      "control T", "next-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
                "control shift T", "previous-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
                  "control SPACE", "activate-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
                "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        Object menuItemAcceleratorDelimiter = "+";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        Object ControlBackgroundColor = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
                                                       "win.3d.backgroundColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   470
                                                        table.get("control"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        Object ControlLightColor      = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
                                                       "win.3d.lightColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   473
                                                        table.get("controlHighlight"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        Object ControlHighlightColor  = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                                                       "win.3d.highlightColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   476
                                                        table.get("controlLtHighlight"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
        Object ControlShadowColor     = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
                                                       "win.3d.shadowColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   479
                                                        table.get("controlShadow"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        Object ControlDarkShadowColor = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
                                                       "win.3d.darkShadowColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   482
                                                        table.get("controlDkShadow"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        Object ControlTextColor       = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
                                                       "win.button.textColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   485
                                                        table.get("controlText"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        Object MenuBackgroundColor    = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                                                       "win.menu.backgroundColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   488
                                                        table.get("menu"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        Object MenuBarBackgroundColor = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                                                       "win.menubar.backgroundColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   491
                                                        table.get("menu"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        Object MenuTextColor          = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
                                                       "win.menu.textColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   494
                                                        table.get("menuText"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        Object SelectionBackgroundColor = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
                                                       "win.item.highlightColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   497
                                                        table.get("textHighlight"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        Object SelectionTextColor     = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
                                                       "win.item.highlightTextColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   500
                                                        table.get("textHighlightText"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        Object WindowBackgroundColor  = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
                                                       "win.frame.backgroundColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   503
                                                        table.get("window"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        Object WindowTextColor        = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
                                                       "win.frame.textColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   506
                                                        table.get("windowText"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
        Object WindowBorderWidth      = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
                                                       "win.frame.sizingBorderWidth",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   509
                                                       Integer.valueOf(1));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        Object TitlePaneHeight        = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
                                                       "win.frame.captionHeight",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   512
                                                       Integer.valueOf(18));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        Object TitleButtonWidth       = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
                                                       "win.frame.captionButtonWidth",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   515
                                                       Integer.valueOf(16));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        Object TitleButtonHeight      = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
                                                       "win.frame.captionButtonHeight",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   518
                                                       Integer.valueOf(16));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        Object InactiveTextColor      = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
                                                       "win.text.grayedTextColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   521
                                                        table.get("textInactiveText"));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
        Object ScrollbarBackgroundColor = new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
                                                       "win.scrollbar.backgroundColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   524
                                                        table.get("scrollbar"));
11975
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
   525
        Object buttonFocusColor = new FocusColorProperty();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
        Object TextBackground         = new XPColorValue(Part.EP_EDIT, null, Prop.FILLCOLOR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
                                                         WindowBackgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        //The following four lines were commented out as part of bug 4991597
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        //This code *is* correct, however it differs from WindowsXP and is, apparently
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        //a Windows XP bug. Until Windows fixes this bug, we shall also exhibit the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
        //behavior
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        //Object ReadOnlyTextBackground = new XPColorValue(Part.EP_EDITTEXT, State.READONLY, Prop.FILLCOLOR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
        //                                                 ControlBackgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
        //Object DisabledTextBackground = new XPColorValue(Part.EP_EDITTEXT, State.DISABLED, Prop.FILLCOLOR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
        //                                                 ControlBackgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
        Object ReadOnlyTextBackground = ControlBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        Object DisabledTextBackground = ControlBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        Object MenuFont = dialogPlain12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
        Object FixedControlFont = monospacedPlain12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        Object ControlFont = dialogPlain12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
        Object MessageFont = dialogPlain12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
        Object WindowFont = dialogBold12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        Object ToolTipFont = sansSerifPlain12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
        Object IconFont = ControlFont;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   548
        Object scrollBarWidth = new DesktopProperty("win.scrollbar.width", Integer.valueOf(16));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   550
        Object menuBarHeight = new DesktopProperty("win.menu.height", null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   552
        Object hotTrackingOn = new DesktopProperty("win.item.hotTrackingOn", true);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   554
        Object showMnemonics = new DesktopProperty("win.menu.keyboardCuesOn", Boolean.TRUE);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
        if (useSystemFontSettings) {
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   557
            MenuFont = getDesktopFontValue("win.menu.font", MenuFont);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   558
            FixedControlFont = getDesktopFontValue("win.ansiFixed.font", FixedControlFont);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   559
            ControlFont = getDesktopFontValue("win.defaultGUI.font", ControlFont);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   560
            MessageFont = getDesktopFontValue("win.messagebox.font", MessageFont);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   561
            WindowFont = getDesktopFontValue("win.frame.captionFont", WindowFont);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   562
            IconFont    = getDesktopFontValue("win.icon.font", IconFont);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   563
            ToolTipFont = getDesktopFontValue("win.tooltip.font", ToolTipFont);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
            /* Put the desktop AA settings in the defaults.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
             * JComponent.setUI() retrieves this and makes it available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
             * as a client property on the JComponent. Use the same key name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
             * for both client property and UIDefaults.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
             * Also need to set up listeners for changes in these settings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
            Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
            table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
            this.aaSettings =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
                new FontDesktopProperty(SunToolkit.DESKTOPFONTHINTS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        if (useSystemFontSizeSettings) {
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   577
            MenuFont = new WindowsFontSizeProperty("win.menu.font.height", Font.DIALOG, Font.PLAIN, 12);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   578
            FixedControlFont = new WindowsFontSizeProperty("win.ansiFixed.font.height", Font.MONOSPACED,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
                       Font.PLAIN, 12);
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   580
            ControlFont = new WindowsFontSizeProperty("win.defaultGUI.font.height", Font.DIALOG, Font.PLAIN, 12);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   581
            MessageFont = new WindowsFontSizeProperty("win.messagebox.font.height", Font.DIALOG, Font.PLAIN, 12);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   582
            WindowFont = new WindowsFontSizeProperty("win.frame.captionFont.height", Font.DIALOG, Font.BOLD, 12);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   583
            ToolTipFont = new WindowsFontSizeProperty("win.tooltip.font.height", Font.SANS_SERIF, Font.PLAIN, 12);
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   584
            IconFont    = new WindowsFontSizeProperty("win.icon.font.height", Font.DIALOG, Font.PLAIN, 12);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
        if (!(this instanceof WindowsClassicLookAndFeel) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
            (OSInfo.getOSType() == OSInfo.OSType.WINDOWS &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
             OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) >= 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
            AccessController.doPrivileged(new GetPropertyAction("swing.noxp")) == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
            // These desktop properties are not used directly, but are needed to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
            // trigger realoading of UI's.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
            this.themeActive = new TriggerDesktopProperty("win.xpstyle.themeActive");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
            this.dllName     = new TriggerDesktopProperty("win.xpstyle.dllName");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
            this.colorName   = new TriggerDesktopProperty("win.xpstyle.colorName");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
            this.sizeName    = new TriggerDesktopProperty("win.xpstyle.sizeName");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
        Object[] defaults = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
            // *** Auditory Feedback
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
            // this key defines which of the various cues to render
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
            // Overridden from BasicL&F. This L&F should play all sounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
            // all the time. The infrastructure decides what to play.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
            // This is disabled until sound bugs can be resolved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
            "AuditoryCues.playList", null, // table.get("AuditoryCues.cueList"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
            "Application.useSystemFontSettings", Boolean.valueOf(useSystemFontSettings),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
            "TextField.focusInputMap", fieldInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
            "PasswordField.focusInputMap", passwordInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
            "TextArea.focusInputMap", multilineInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
            "TextPane.focusInputMap", multilineInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
            "EditorPane.focusInputMap", multilineInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
            // Buttons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
            "Button.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
            "Button.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
            // Button.foreground, Button.shadow, Button.darkShadow,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
            // Button.disabledForground, and Button.disabledShadow are only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
            // used for Windows Classic. Windows XP will use colors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
            // from the current visual style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
            "Button.foreground", ControlTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
            "Button.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
            "Button.darkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
            "Button.light", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
            "Button.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
            "Button.disabledForeground", InactiveTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
            "Button.disabledShadow", ControlHighlightColor,
11975
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
   632
            "Button.focus", buttonFocusColor,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   633
            "Button.dashedRectGapX", new XPValue(Integer.valueOf(3), Integer.valueOf(5)),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   634
            "Button.dashedRectGapY", new XPValue(Integer.valueOf(3), Integer.valueOf(4)),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   635
            "Button.dashedRectGapWidth", new XPValue(Integer.valueOf(6), Integer.valueOf(10)),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   636
            "Button.dashedRectGapHeight", new XPValue(Integer.valueOf(6), Integer.valueOf(8)),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   637
            "Button.textShiftOffset", new XPValue(Integer.valueOf(0),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   638
                                                  Integer.valueOf(1)),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
            // W2K keyboard navigation hidding.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
            "Button.showMnemonics", showMnemonics,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
            "Button.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
                            "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
                   "released SPACE", "released"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
13779
011727a60840 6994562: Swing classes (both JTextArea and JTextField) don't support caret width tuning
VKARNAUK
parents: 11975
diff changeset
   647
            "Caret.width",
011727a60840 6994562: Swing classes (both JTextArea and JTextField) don't support caret width tuning
VKARNAUK
parents: 11975
diff changeset
   648
                  new DesktopProperty("win.caret.width", null),
011727a60840 6994562: Swing classes (both JTextArea and JTextField) don't support caret width tuning
VKARNAUK
parents: 11975
diff changeset
   649
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
            "CheckBox.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
            "CheckBox.interiorBackground", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
            "CheckBox.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
            "CheckBox.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
            "CheckBox.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
            "CheckBox.darkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
            "CheckBox.light", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
            "CheckBox.highlight", ControlHighlightColor,
11975
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
   658
            "CheckBox.focus", buttonFocusColor,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
            "CheckBox.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
                            "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                   "released SPACE", "released"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
            // margin is 2 all the way around, BasicBorders.RadioButtonBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
            // (checkbox uses RadioButtonBorder) is 2 all the way around too.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
            "CheckBox.totalInsets", new Insets(4, 4, 4, 4),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
            "CheckBoxMenuItem.font", MenuFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
            "CheckBoxMenuItem.background", MenuBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
            "CheckBoxMenuItem.foreground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
            "CheckBoxMenuItem.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
            "CheckBoxMenuItem.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
            "CheckBoxMenuItem.acceleratorForeground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
            "CheckBoxMenuItem.acceleratorSelectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
            "CheckBoxMenuItem.commandSound", "win.sound.menuCommand",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
            "ComboBox.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
            "ComboBox.background", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
            "ComboBox.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
            "ComboBox.buttonBackground", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
            "ComboBox.buttonShadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
            "ComboBox.buttonDarkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
            "ComboBox.buttonHighlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
            "ComboBox.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
            "ComboBox.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
            "ComboBox.editorBorder", new XPValue(new EmptyBorder(1,2,1,1),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
                                                 new EmptyBorder(1,4,1,4)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
            "ComboBox.disabledBackground",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
                        new XPColorValue(Part.CP_COMBOBOX, State.DISABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
                        Prop.FILLCOLOR, DisabledTextBackground),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
            "ComboBox.disabledForeground",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
                        new XPColorValue(Part.CP_COMBOBOX, State.DISABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
                        Prop.TEXTCOLOR, InactiveTextColor),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
            "ComboBox.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
                   "ESCAPE", "hidePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
                  "PAGE_UP", "pageUpPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
                "PAGE_DOWN", "pageDownPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
                     "HOME", "homePassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
                      "END", "endPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                     "DOWN", "selectNext2",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
                  "KP_DOWN", "selectNext2",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
                       "UP", "selectPrevious2",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
                    "KP_UP", "selectPrevious2",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
                    "ENTER", "enterPressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
                       "F4", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
                 "alt DOWN", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
              "alt KP_DOWN", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
                   "alt UP", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
                "alt KP_UP", "togglePopup"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
              }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
            // DeskTop.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
            "Desktop.background", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
                                                 "win.desktop.backgroundColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   715
                                                  table.get("desktop")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
            "Desktop.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
                   "ctrl F5", "restore",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
                   "ctrl F4", "close",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
                   "ctrl F7", "move",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
                   "ctrl F8", "resize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
                   "RIGHT", "right",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
                   "KP_RIGHT", "right",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
                   "LEFT", "left",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
                   "KP_LEFT", "left",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
                   "UP", "up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
                   "KP_UP", "up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
                   "DOWN", "down",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
                   "KP_DOWN", "down",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
                   "ESCAPE", "escape",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
                   "ctrl F9", "minimize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
                   "ctrl F10", "maximize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
                   "ctrl F6", "selectNextFrame",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
                   "ctrl TAB", "selectNextFrame",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
                   "ctrl alt F6", "selectNextFrame",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
                   "shift ctrl alt F6", "selectPreviousFrame",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
                   "ctrl F12", "navigateNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
                   "shift ctrl F12", "navigatePrevious"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
               }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
            // DesktopIcon
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   742
            "DesktopIcon.width", Integer.valueOf(160),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
            "EditorPane.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
            "EditorPane.background", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
            "EditorPane.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
            "EditorPane.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
            "EditorPane.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
            "EditorPane.caretForeground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
            "EditorPane.inactiveForeground", InactiveTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
            "EditorPane.inactiveBackground", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
            "EditorPane.disabledBackground", DisabledTextBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
            "FileChooser.homeFolderIcon",  new LazyWindowsIcon(null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                                                               "icons/HomeFolder.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
            "FileChooser.listFont", IconFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
            "FileChooser.listViewBackground", new XPColorValue(Part.LVP_LISTVIEW, null, Prop.FILLCOLOR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
                                                               WindowBackgroundColor),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
            "FileChooser.listViewBorder", new XPBorderValue(Part.LVP_LISTVIEW,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
                                                  new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
                                                        "javax.swing.plaf.BorderUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
                                                        "getLoweredBevelBorderUIResource")),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
            "FileChooser.listViewIcon",    new LazyWindowsIcon("fileChooserIcon ListView",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
                                                               "icons/ListView.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
            "FileChooser.listViewWindowsStyle", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
            "FileChooser.detailsViewIcon", new LazyWindowsIcon("fileChooserIcon DetailsView",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
                                                               "icons/DetailsView.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
            "FileChooser.viewMenuIcon", new LazyWindowsIcon("fileChooserIcon ViewMenu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
                                                            "icons/ListView.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
            "FileChooser.upFolderIcon",    new LazyWindowsIcon("fileChooserIcon UpFolder",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
                                                               "icons/UpFolder.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
            "FileChooser.newFolderIcon",   new LazyWindowsIcon("fileChooserIcon NewFolder",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
                                                               "icons/NewFolder.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
            "FileChooser.useSystemExtensionHiding", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
            "FileChooser.usesSingleFilePane", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
            "FileChooser.noPlacesBar", new DesktopProperty("win.comdlg.noPlacesBar",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   778
                                                           Boolean.FALSE),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
            "FileChooser.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
                     "ESCAPE", "cancelSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
                     "F2", "editFileName",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
                     "F5", "refresh",
680
eaff686e34f7 5035693: "Open" button should be a default one in JFileChooser under Windows XP LAF
rupashka
parents: 438
diff changeset
   784
                     "BACK_SPACE", "Go Up"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
            "FileView.directoryIcon", SwingUtilities2.makeIcon(getClass(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
                                                               WindowsLookAndFeel.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
                                                               "icons/Directory.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
            "FileView.fileIcon", SwingUtilities2.makeIcon(getClass(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
                                                          WindowsLookAndFeel.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
                                                          "icons/File.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
            "FileView.computerIcon", SwingUtilities2.makeIcon(getClass(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
                                                              WindowsLookAndFeel.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
                                                              "icons/Computer.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
            "FileView.hardDriveIcon", SwingUtilities2.makeIcon(getClass(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
                                                               WindowsLookAndFeel.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
                                                               "icons/HardDrive.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
            "FileView.floppyDriveIcon", SwingUtilities2.makeIcon(getClass(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
                                                                 WindowsLookAndFeel.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
                                                                 "icons/FloppyDrive.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
            "FormattedTextField.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
            "InternalFrame.titleFont", WindowFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
            "InternalFrame.titlePaneHeight",   TitlePaneHeight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
            "InternalFrame.titleButtonWidth",  TitleButtonWidth,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
            "InternalFrame.titleButtonHeight", TitleButtonHeight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
            "InternalFrame.titleButtonToolTipsOn", hotTrackingOn,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
            "InternalFrame.borderColor", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
            "InternalFrame.borderShadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
            "InternalFrame.borderDarkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
            "InternalFrame.borderHighlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
            "InternalFrame.borderLight", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
            "InternalFrame.borderWidth", WindowBorderWidth,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
            "InternalFrame.minimizeIconBackground", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
            "InternalFrame.resizeIconHighlight", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
            "InternalFrame.resizeIconShadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
            "InternalFrame.activeBorderColor", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
                                                       "win.frame.activeBorderColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   820
                                                       table.get("windowBorder")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
            "InternalFrame.inactiveBorderColor", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
                                                       "win.frame.inactiveBorderColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   823
                                                       table.get("windowBorder")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
            "InternalFrame.activeTitleBackground", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
                                                        "win.frame.activeCaptionColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   826
                                                         table.get("activeCaption")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
            "InternalFrame.activeTitleGradient", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
                                                        "win.frame.activeCaptionGradientColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   829
                                                         table.get("activeCaption")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
            "InternalFrame.activeTitleForeground", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
                                                        "win.frame.captionTextColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   832
                                                         table.get("activeCaptionText")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
            "InternalFrame.inactiveTitleBackground", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
                                                        "win.frame.inactiveCaptionColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   835
                                                         table.get("inactiveCaption")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
            "InternalFrame.inactiveTitleGradient", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
                                                        "win.frame.inactiveCaptionGradientColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   838
                                                         table.get("inactiveCaption")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
            "InternalFrame.inactiveTitleForeground", new DesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
                                                        "win.frame.inactiveCaptionTextColor",
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
   841
                                                         table.get("inactiveCaptionText")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
            "InternalFrame.maximizeIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
                WindowsIconFactory.createFrameMaximizeIcon(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
            "InternalFrame.minimizeIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
                WindowsIconFactory.createFrameMinimizeIcon(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
            "InternalFrame.iconifyIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
                WindowsIconFactory.createFrameIconifyIcon(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
            "InternalFrame.closeIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
                WindowsIconFactory.createFrameCloseIcon(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
            "InternalFrame.icon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
                new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
        "com.sun.java.swing.plaf.windows.WindowsInternalFrameTitlePane$ScalableIconUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
                    // The constructor takes one arg: an array of UIDefaults.LazyValue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
                    // representing the icons
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
                    new Object[][] { {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
                        SwingUtilities2.makeIcon(getClass(), BasicLookAndFeel.class, "icons/JavaCup16.png"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
                        SwingUtilities2.makeIcon(getClass(), WindowsLookAndFeel.class, "icons/JavaCup32.png")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
                    } }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
            // Internal Frame Auditory Cue Mappings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
            "InternalFrame.closeSound", "win.sound.close",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
            "InternalFrame.maximizeSound", "win.sound.maximize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
            "InternalFrame.minimizeSound", "win.sound.minimize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
            "InternalFrame.restoreDownSound", "win.sound.restoreDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
            "InternalFrame.restoreUpSound", "win.sound.restoreUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
            "InternalFrame.windowBindings", new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
                "shift ESCAPE", "showSystemMenu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
                  "ctrl SPACE", "showSystemMenu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
                      "ESCAPE", "hideSystemMenu"},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
            // Label
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
            "Label.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
            "Label.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
            "Label.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
            "Label.disabledForeground", InactiveTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
            "Label.disabledShadow", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
            // List.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
            "List.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
            "List.background", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
            "List.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
            "List.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
            "List.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
            "List.lockToPositionOnScroll", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
            "List.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
                           "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
                           "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
                           "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
                             "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
                            "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
                              "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
                   "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
                     "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
                     "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
                               "UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
                            "KP_UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
                         "shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
                      "shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
                    "ctrl shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
                 "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
                          "ctrl UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
                       "ctrl KP_UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
                             "DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
                          "KP_DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
                       "shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
                    "shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
                  "ctrl shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
               "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
                        "ctrl DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
                     "ctrl KP_DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
                             "LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
                          "KP_LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
                       "shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
                    "shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
                  "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
               "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
                        "ctrl LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
                     "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
                            "RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
                         "KP_RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
                      "shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
                   "shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
                 "ctrl shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
              "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
                       "ctrl RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
                    "ctrl KP_RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
                             "HOME", "selectFirstRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
                       "shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
                  "ctrl shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
                        "ctrl HOME", "selectFirstRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
                              "END", "selectLastRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
                        "shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
                   "ctrl shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
                         "ctrl END", "selectLastRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
                          "PAGE_UP", "scrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
                    "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
               "ctrl shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
                     "ctrl PAGE_UP", "scrollUpChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
                        "PAGE_DOWN", "scrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
                  "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
             "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
                   "ctrl PAGE_DOWN", "scrollDownChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
                           "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
                       "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
                  "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
                            "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
                       "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
                      "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
                 "ctrl shift SPACE", "moveSelectionTo"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
            // PopupMenu
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
            "PopupMenu.font", MenuFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
            "PopupMenu.background", MenuBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
            "PopupMenu.foreground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
            "PopupMenu.popupSound", "win.sound.menuPopup",
2658
43e06bc950ec 6591875: Nimbus Swing Look and Feel
peterz
parents: 1847
diff changeset
   960
            "PopupMenu.consumeEventOnClose", Boolean.TRUE,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
            // Menus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
            "Menu.font", MenuFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
            "Menu.foreground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
            "Menu.background", MenuBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
            "Menu.useMenuBarBackgroundForTopLevel", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
            "Menu.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
            "Menu.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
            "Menu.acceleratorForeground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
            "Menu.acceleratorSelectionForeground", SelectionTextColor,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   971
            "Menu.menuPopupOffsetX", Integer.valueOf(0),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   972
            "Menu.menuPopupOffsetY", Integer.valueOf(0),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   973
            "Menu.submenuPopupOffsetX", Integer.valueOf(-4),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   974
            "Menu.submenuPopupOffsetY", Integer.valueOf(-3),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
            "Menu.crossMenuMnemonic", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
            "Menu.preserveTopLevelSelection", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
            // MenuBar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
            "MenuBar.font", MenuFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
            "MenuBar.background", new XPValue(MenuBarBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
                                              MenuBackgroundColor),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
            "MenuBar.foreground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
            "MenuBar.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
            "MenuBar.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
            "MenuBar.height", menuBarHeight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
            "MenuBar.rolloverEnabled", hotTrackingOn,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
            "MenuBar.windowBindings", new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
                "F10", "takeFocus" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
            "MenuItem.font", MenuFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
            "MenuItem.acceleratorFont", MenuFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
            "MenuItem.foreground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
            "MenuItem.background", MenuBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
            "MenuItem.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
            "MenuItem.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
            "MenuItem.disabledForeground", InactiveTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
            "MenuItem.acceleratorForeground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
            "MenuItem.acceleratorSelectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
            "MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
                 // Menu Item Auditory Cue Mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
            "MenuItem.commandSound", "win.sound.menuCommand",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
             // indicates that keyboard navigation won't skip disabled menu items
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
            "MenuItem.disabledAreNavigable", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
            "RadioButton.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
            "RadioButton.interiorBackground", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
            "RadioButton.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
            "RadioButton.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
            "RadioButton.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
            "RadioButton.darkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
            "RadioButton.light", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
            "RadioButton.highlight", ControlHighlightColor,
11975
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  1013
            "RadioButton.focus", buttonFocusColor,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
            "RadioButton.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
                          "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
                 "released SPACE", "released"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
              }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
            // margin is 2 all the way around, BasicBorders.RadioButtonBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
            // is 2 all the way around too.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
            "RadioButton.totalInsets", new Insets(4, 4, 4, 4),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
            "RadioButtonMenuItem.font", MenuFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
            "RadioButtonMenuItem.foreground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
            "RadioButtonMenuItem.background", MenuBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
            "RadioButtonMenuItem.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
            "RadioButtonMenuItem.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
            "RadioButtonMenuItem.disabledForeground", InactiveTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
            "RadioButtonMenuItem.acceleratorForeground", MenuTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
            "RadioButtonMenuItem.acceleratorSelectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
            "RadioButtonMenuItem.commandSound", "win.sound.menuCommand",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
            // OptionPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
            "OptionPane.font", MessageFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
            "OptionPane.messageFont", MessageFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
            "OptionPane.buttonFont", MessageFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
            "OptionPane.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
            "OptionPane.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
            "OptionPane.buttonMinimumWidth", new XPDLUValue(50, 50, SwingConstants.EAST),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
            "OptionPane.messageForeground", ControlTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
            "OptionPane.errorIcon",       new LazyWindowsIcon("optionPaneIcon Error",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
                                                              "icons/Error.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
            "OptionPane.informationIcon", new LazyWindowsIcon("optionPaneIcon Information",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
                                                              "icons/Inform.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
            "OptionPane.questionIcon",    new LazyWindowsIcon("optionPaneIcon Question",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
                                                              "icons/Question.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
            "OptionPane.warningIcon",     new LazyWindowsIcon("optionPaneIcon Warning",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
                                                              "icons/Warn.gif"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
            "OptionPane.windowBindings", new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
                "ESCAPE", "close" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
                 // Option Pane Auditory Cue Mappings
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
            "OptionPane.errorSound", "win.sound.hand", // Error
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
            "OptionPane.informationSound", "win.sound.asterisk", // Info Plain
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
            "OptionPane.questionSound", "win.sound.question", // Question
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
            "OptionPane.warningSound", "win.sound.exclamation", // Warning
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
            "FormattedTextField.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
              new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
                           "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
                           "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
                           "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
                             "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
                            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
                              "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
                   "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
                     "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
                     "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
                       "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
                      "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
                   "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
                        "ctrl LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
                     "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
                       "ctrl RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
                    "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
                  "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
               "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
                 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
              "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
                           "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
                             "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
                              "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
                       "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
                        "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
                 "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
                           "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
                      "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
                  "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
                            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
                             "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
                         "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
                          "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
                            "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
                  "ctrl BACK_SLASH", "unselect",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
                   "control shift O", "toggle-componentOrientation",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
                           "ESCAPE", "reset-field-edit",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
                               "UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
                            "KP_UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
                             "DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
                          "KP_DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
              }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
            "FormattedTextField.inactiveBackground", ReadOnlyTextBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
            "FormattedTextField.disabledBackground", DisabledTextBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
            // *** Panel
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
            "Panel.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
            "Panel.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
            "Panel.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
            // *** PasswordField
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
            "PasswordField.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
            "PasswordField.background", TextBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
            "PasswordField.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
            "PasswordField.inactiveForeground", InactiveTextColor,      // for disabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
            "PasswordField.inactiveBackground", ReadOnlyTextBackground, // for readonly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
            "PasswordField.disabledBackground", DisabledTextBackground, // for disabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
            "PasswordField.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
            "PasswordField.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
            "PasswordField.caretForeground",WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
            "PasswordField.echoChar", new XPValue(new Character((char)0x25CF),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
                                                  new Character('*')),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
            // *** ProgressBar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
            "ProgressBar.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
            "ProgressBar.foreground",  SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
            "ProgressBar.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
            "ProgressBar.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
            "ProgressBar.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
            "ProgressBar.selectionForeground", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
            "ProgressBar.selectionBackground", SelectionBackgroundColor,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1134
            "ProgressBar.cellLength", Integer.valueOf(7),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1135
            "ProgressBar.cellSpacing", Integer.valueOf(2),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
            "ProgressBar.indeterminateInsets", new Insets(3, 3, 3, 3),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
            // *** RootPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
            // These bindings are only enabled when there is a default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
            // button set on the rootpane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
            "RootPane.defaultButtonWindowKeyBindings", new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
                             "ENTER", "press",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
                    "released ENTER", "release",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
                        "ctrl ENTER", "press",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
               "ctrl released ENTER", "release"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
              },
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
            // *** ScrollBar.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
            "ScrollBar.background", ScrollbarBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
            "ScrollBar.foreground", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
            "ScrollBar.track", white,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
            "ScrollBar.trackForeground", ScrollbarBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
            "ScrollBar.trackHighlight", black,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
            "ScrollBar.trackHighlightForeground", scrollBarTrackHighlight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
            "ScrollBar.thumb", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
            "ScrollBar.thumbHighlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
            "ScrollBar.thumbDarkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
            "ScrollBar.thumbShadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
            "ScrollBar.width", scrollBarWidth,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
            "ScrollBar.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
                       "RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
                    "KP_RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
                        "DOWN", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
                     "KP_DOWN", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
                   "PAGE_DOWN", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
              "ctrl PAGE_DOWN", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
                        "LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
                     "KP_LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
                          "UP", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
                       "KP_UP", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
                     "PAGE_UP", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
                "ctrl PAGE_UP", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
                        "HOME", "minScroll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
                         "END", "maxScroll"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
            // *** ScrollPane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
            "ScrollPane.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
            "ScrollPane.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
            "ScrollPane.foreground", ControlTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
            "ScrollPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
                           "RIGHT", "unitScrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
                        "KP_RIGHT", "unitScrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
                            "DOWN", "unitScrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
                         "KP_DOWN", "unitScrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
                            "LEFT", "unitScrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
                         "KP_LEFT", "unitScrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
                              "UP", "unitScrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
                           "KP_UP", "unitScrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
                         "PAGE_UP", "scrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
                       "PAGE_DOWN", "scrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
                    "ctrl PAGE_UP", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
                  "ctrl PAGE_DOWN", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
                       "ctrl HOME", "scrollHome",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
                        "ctrl END", "scrollEnd"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
            // *** Separator
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
            "Separator.background", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
            "Separator.foreground", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
            // *** Slider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
            "Slider.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
            "Slider.foreground", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
            "Slider.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
            "Slider.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
            "Slider.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
            "Slider.focus", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
            "Slider.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
                       "RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
                    "KP_RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
                        "DOWN", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
                     "KP_DOWN", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
                   "PAGE_DOWN", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
                        "LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
                     "KP_LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
                          "UP", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
                       "KP_UP", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
                     "PAGE_UP", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
                        "HOME", "minScroll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
                         "END", "maxScroll"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
            // Spinner
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
            "Spinner.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
            "Spinner.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
                               "UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
                            "KP_UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
                             "DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
                          "KP_DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
               }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
            // *** SplitPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
            "SplitPane.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
            "SplitPane.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
            "SplitPane.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
            "SplitPane.darkShadow", ControlDarkShadowColor,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1242
            "SplitPane.dividerSize", Integer.valueOf(5),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
            "SplitPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
                        "UP", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
                      "DOWN", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
                      "LEFT", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
                     "RIGHT", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
                     "KP_UP", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
                   "KP_DOWN", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
                   "KP_LEFT", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
                  "KP_RIGHT", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
                      "HOME", "selectMin",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
                       "END", "selectMax",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
                        "F8", "startResize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
                        "F6", "toggleFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
                  "ctrl TAB", "focusOutForward",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
            "ctrl shift TAB", "focusOutBackward"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
               }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
            // *** TabbedPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
            "TabbedPane.tabsOverlapBorder", new XPValue(Boolean.TRUE, Boolean.FALSE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
            "TabbedPane.tabInsets",         new XPValue(new InsetsUIResource(1, 4, 1, 4),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
                                                        new InsetsUIResource(0, 4, 1, 4)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
            "TabbedPane.tabAreaInsets",     new XPValue(new InsetsUIResource(3, 2, 2, 2),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
                                                        new InsetsUIResource(3, 2, 0, 2)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
            "TabbedPane.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
            "TabbedPane.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
            "TabbedPane.foreground", ControlTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
            "TabbedPane.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
            "TabbedPane.light", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
            "TabbedPane.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
            "TabbedPane.darkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
            "TabbedPane.focus", ControlTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
            "TabbedPane.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
              new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
                         "RIGHT", "navigateRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
                      "KP_RIGHT", "navigateRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
                          "LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
                       "KP_LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
                            "UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
                         "KP_UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
                          "DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
                       "KP_DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
                     "ctrl DOWN", "requestFocusForVisibleComponent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
                  "ctrl KP_DOWN", "requestFocusForVisibleComponent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
                }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
            "TabbedPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
                         "ctrl TAB", "navigateNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
                   "ctrl shift TAB", "navigatePrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
                   "ctrl PAGE_DOWN", "navigatePageDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
                     "ctrl PAGE_UP", "navigatePageUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
                          "ctrl UP", "requestFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
                       "ctrl KP_UP", "requestFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
            // *** Table
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
            "Table.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
            "Table.foreground", ControlTextColor,  // cell text color
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
            "Table.background", WindowBackgroundColor,  // cell background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
            "Table.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
            "Table.light", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
            "Table.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
            "Table.darkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
            "Table.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
            "Table.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
            "Table.gridColor", gray,  // grid line color
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
            "Table.focusCellBackground", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
            "Table.focusCellForeground", ControlTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
            "Table.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
                               "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
                               "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
                               "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
                                 "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
                                "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
                                  "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
                       "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
                         "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
                         "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
                                "RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
                             "KP_RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
                          "shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
                       "shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
                     "ctrl shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
                  "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
                           "ctrl RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
                        "ctrl KP_RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
                                 "LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
                              "KP_LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
                           "shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
                        "shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
                      "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
                   "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
                            "ctrl LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
                         "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
                                 "DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
                              "KP_DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
                           "shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
                        "shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
                      "ctrl shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
                   "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
                            "ctrl DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
                         "ctrl KP_DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
                                   "UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
                                "KP_UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
                             "shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
                          "shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
                        "ctrl shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
                     "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
                              "ctrl UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
                           "ctrl KP_UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
                                 "HOME", "selectFirstColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
                           "shift HOME", "selectFirstColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
                      "ctrl shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
                            "ctrl HOME", "selectFirstRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
                                  "END", "selectLastColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
                            "shift END", "selectLastColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
                       "ctrl shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
                             "ctrl END", "selectLastRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
                              "PAGE_UP", "scrollUpChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
                        "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
                   "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
                         "ctrl PAGE_UP", "scrollLeftChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
                            "PAGE_DOWN", "scrollDownChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
                      "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
                 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
                       "ctrl PAGE_DOWN", "scrollRightChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
                                  "TAB", "selectNextColumnCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
                            "shift TAB", "selectPreviousColumnCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
                                "ENTER", "selectNextRowCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
                          "shift ENTER", "selectPreviousRowCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
                               "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
                           "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
                      "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
                               "ESCAPE", "cancel",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
                                   "F2", "startEditing",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
                                "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
                           "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
                          "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
                     "ctrl shift SPACE", "moveSelectionTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
                                   "F8", "focusHeader"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
            "Table.sortIconHighlight", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
            "Table.sortIconLight", white,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
            "TableHeader.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
            "TableHeader.foreground", ControlTextColor, // header text color
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
            "TableHeader.background", ControlBackgroundColor, // header background
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
            "TableHeader.focusCellBackground",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
                new XPValue(XPValue.NULL_VALUE,     // use default bg from XP styles
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
                            WindowBackgroundColor), // or white bg otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
            // *** TextArea
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
            "TextArea.font", FixedControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
            "TextArea.background", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
            "TextArea.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
            "TextArea.inactiveForeground", InactiveTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
            "TextArea.inactiveBackground", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
            "TextArea.disabledBackground", DisabledTextBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
            "TextArea.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
            "TextArea.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
            "TextArea.caretForeground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
            // *** TextField
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
            "TextField.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
            "TextField.background", TextBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
            "TextField.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
            "TextField.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
            "TextField.darkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
            "TextField.light", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
            "TextField.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
            "TextField.inactiveForeground", InactiveTextColor,      // for disabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1415
            "TextField.inactiveBackground", ReadOnlyTextBackground, // for readonly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
            "TextField.disabledBackground", DisabledTextBackground, // for disabled
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
            "TextField.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
            "TextField.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
            "TextField.caretForeground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1421
            // *** TextPane
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1422
            "TextPane.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1423
            "TextPane.background", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1424
            "TextPane.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1425
            "TextPane.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
            "TextPane.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
            "TextPane.inactiveBackground", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
            "TextPane.disabledBackground", DisabledTextBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
            "TextPane.caretForeground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
            // *** TitledBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
            "TitledBorder.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
            "TitledBorder.titleColor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
                        new XPColorValue(Part.BP_GROUPBOX, null, Prop.TEXTCOLOR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
                                         WindowTextColor),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
            // *** ToggleButton
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
            "ToggleButton.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
            "ToggleButton.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
            "ToggleButton.foreground", ControlTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
            "ToggleButton.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
            "ToggleButton.darkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
            "ToggleButton.light", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
            "ToggleButton.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
            "ToggleButton.focus", ControlTextColor,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1446
            "ToggleButton.textShiftOffset", Integer.valueOf(1),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
            "ToggleButton.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
              new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
                            "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
                   "released SPACE", "released"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
                }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
            // *** ToolBar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
            "ToolBar.font", MenuFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
            "ToolBar.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
            "ToolBar.foreground", ControlTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
            "ToolBar.shadow", ControlShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
            "ToolBar.darkShadow", ControlDarkShadowColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1459
            "ToolBar.light", ControlLightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
            "ToolBar.highlight", ControlHighlightColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
            "ToolBar.dockingBackground", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
            "ToolBar.dockingForeground", red,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
            "ToolBar.floatingBackground", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1464
            "ToolBar.floatingForeground", darkGray,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
            "ToolBar.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
                        "UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
                     "KP_UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
                      "DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
                   "KP_DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
                      "LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
                   "KP_LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1473
                     "RIGHT", "navigateRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1474
                  "KP_RIGHT", "navigateRight"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1475
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
            "ToolBar.separatorSize", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
            // *** ToolTip
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
            "ToolTip.font", ToolTipFont,
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  1480
            "ToolTip.background", new DesktopProperty("win.tooltip.backgroundColor", table.get("info")),
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  1481
            "ToolTip.foreground", new DesktopProperty("win.tooltip.textColor", table.get("infoText")),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
        // *** ToolTipManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
            "ToolTipManager.enableToolTipMode", "activeApplication",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
        // *** Tree
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
            "Tree.selectionBorderColor", black,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
            "Tree.drawDashedFocusIndicator", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
            "Tree.lineTypeDashed", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
            "Tree.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
            "Tree.background", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
            "Tree.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
            "Tree.hash", gray,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1494
            "Tree.leftChildIndent", Integer.valueOf(8),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1495
            "Tree.rightChildIndent", Integer.valueOf(11),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
            "Tree.textForeground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
            "Tree.textBackground", WindowBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
            "Tree.selectionForeground", SelectionTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
            "Tree.selectionBackground", SelectionBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
            "Tree.expandedIcon", treeExpandedIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
            "Tree.collapsedIcon", treeCollapsedIcon,
1847
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  1502
            "Tree.openIcon",   new ActiveWindowsIcon("win.icon.shellIconBPP",
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  1503
                                   "shell32Icon 5", "icons/TreeOpen.gif"),
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  1504
            "Tree.closedIcon", new ActiveWindowsIcon("win.icon.shellIconBPP",
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  1505
                                   "shell32Icon 4", "icons/TreeClosed.gif"),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1506
            "Tree.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
                                    "ADD", "expand",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
                               "SUBTRACT", "collapse",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
                                 "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
                                 "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1512
                                 "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1513
                                   "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
                                  "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
                                    "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
                         "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
                           "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
                           "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
                                     "UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
                                  "KP_UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
                               "shift UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
                            "shift KP_UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
                          "ctrl shift UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
                       "ctrl shift KP_UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
                                "ctrl UP", "selectPreviousChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
                             "ctrl KP_UP", "selectPreviousChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
                                   "DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
                                "KP_DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
                             "shift DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
                          "shift KP_DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1531
                        "ctrl shift DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
                     "ctrl shift KP_DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
                              "ctrl DOWN", "selectNextChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
                           "ctrl KP_DOWN", "selectNextChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
                                  "RIGHT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
                               "KP_RIGHT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
                                   "LEFT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
                                "KP_LEFT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1539
                                "PAGE_UP", "scrollUpChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1540
                          "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
                     "ctrl shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
                           "ctrl PAGE_UP", "scrollUpChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
                              "PAGE_DOWN", "scrollDownChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
                        "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
                   "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
                         "ctrl PAGE_DOWN", "scrollDownChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
                                   "HOME", "selectFirst",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1548
                             "shift HOME", "selectFirstExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1549
                        "ctrl shift HOME", "selectFirstExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
                              "ctrl HOME", "selectFirstChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
                                    "END", "selectLast",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
                              "shift END", "selectLastExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
                         "ctrl shift END", "selectLastExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
                               "ctrl END", "selectLastChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
                                     "F2", "startEditing",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
                                 "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1557
                             "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1558
                        "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
                              "ctrl LEFT", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
                           "ctrl KP_LEFT", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
                             "ctrl RIGHT", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1562
                          "ctrl KP_RIGHT", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1563
                                  "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
                             "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
                            "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
                       "ctrl shift SPACE", "moveSelectionTo"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1567
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1568
            "Tree.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
                     "ESCAPE", "cancel"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1572
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1573
            // *** Viewport
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
            "Viewport.font", ControlFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
            "Viewport.background", ControlBackgroundColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
            "Viewport.foreground", WindowTextColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1577
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1578
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
        table.putDefaults(defaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1582
        table.putDefaults(getLazyValueDefaults());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1583
        initVistaComponentDefaults(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
    static boolean isOnVista() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1587
        return OSInfo.getOSType() == OSInfo.OSType.WINDOWS
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1588
                && OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_VISTA) >= 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
    private void initVistaComponentDefaults(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1592
        if (! isOnVista()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1593
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
        /* START handling menus for Vista */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
        String[] menuClasses = { "MenuItem", "Menu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1597
                "CheckBoxMenuItem", "RadioButtonMenuItem",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1598
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
        Object menuDefaults[] = new Object[menuClasses.length * 2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
        /* all the menus need to be non opaque. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
            String key = menuClasses[i] + ".opaque";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1606
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1607
            menuDefaults[j++] =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
                new XPValue(Boolean.FALSE, oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1611
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1612
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1613
         * acceleratorSelectionForeground color is the same as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1614
         * acceleratorForeground
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1615
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1616
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1617
            String key = menuClasses[i] + ".acceleratorSelectionForeground";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1618
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
            menuDefaults[j++] =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1621
                new XPValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1622
                    table.getColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
                        menuClasses[i] + ".acceleratorForeground"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
                        oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1626
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1627
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
        /* they have the same MenuItemCheckIconFactory */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
        VistaMenuItemCheckIconFactory menuItemCheckIconFactory =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
            WindowsIconFactory.getMenuItemCheckIconFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1631
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1632
            String key = menuClasses[i] + ".checkIconFactory";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
            menuDefaults[j++] =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1636
                new XPValue(menuItemCheckIconFactory, oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1637
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1641
            String key = menuClasses[i] + ".checkIcon";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1642
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
            menuDefaults[j++] =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
                new XPValue(menuItemCheckIconFactory.getIcon(menuClasses[i]),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1646
                    oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1647
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1650
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1651
        /* height can be even */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1652
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1653
            String key = menuClasses[i] + ".evenHeight";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
            menuDefaults[j++] = new XPValue(Boolean.TRUE, oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1657
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1658
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1659
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1660
        /* no margins */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1661
        InsetsUIResource insets = new InsetsUIResource(0, 0, 0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1662
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
            String key = menuClasses[i] + ".margin";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1664
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1665
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1666
            menuDefaults[j++] = new XPValue(insets, oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1669
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1670
        /* set checkIcon offset */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
        Integer checkIconOffsetInteger =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
            Integer.valueOf(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1674
            String key = menuClasses[i] + ".checkIconOffset";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1675
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1676
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
            menuDefaults[j++] =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
                new XPValue(checkIconOffsetInteger, oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1680
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1681
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1682
        /* set width of the gap after check icon */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1683
        Integer afterCheckIconGap = WindowsPopupMenuUI.getSpanBeforeGutter()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1684
                + WindowsPopupMenuUI.getGutterWidth()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1685
                + WindowsPopupMenuUI.getSpanAfterGutter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1687
            String key = menuClasses[i] + ".afterCheckIconGap";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1688
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1689
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
            menuDefaults[j++] =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
                new XPValue(afterCheckIconGap, oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1692
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1693
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
        /* text is started after this position */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
        Object minimumTextOffset = new UIDefaults.ActiveValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1697
            public Object createValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1698
                return VistaMenuItemCheckIconFactory.getIconWidth()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1699
                + WindowsPopupMenuUI.getSpanBeforeGutter()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1700
                + WindowsPopupMenuUI.getGutterWidth()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1701
                + WindowsPopupMenuUI.getSpanAfterGutter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1702
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1703
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1704
        for (int i = 0, j = 0; i < menuClasses.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1705
            String key = menuClasses[i] + ".minimumTextOffset";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1706
            Object oldValue = table.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1707
            menuDefaults[j++] = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1708
            menuDefaults[j++] = new XPValue(minimumTextOffset, oldValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1709
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1710
        table.putDefaults(menuDefaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1711
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1712
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1713
         * JPopupMenu has a bit of free space around menu items
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1714
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1715
        String POPUP_MENU_BORDER = "PopupMenu.border";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1717
        Object popupMenuBorder = new XPBorderValue(Part.MENU,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1718
                new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1719
                  "javax.swing.plaf.basic.BasicBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1720
                  "getInternalFrameBorder"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1721
                  BorderFactory.createEmptyBorder(2, 2, 2, 2));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1722
        table.put(POPUP_MENU_BORDER, popupMenuBorder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1723
        /* END handling menus for Vista */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1724
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1725
        /* START table handling for Vista */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1726
        table.put("Table.ascendingSortIcon", new XPValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1727
            new SkinIcon(Part.HP_HEADERSORTARROW, State.SORTEDDOWN),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1728
            new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1729
                "sun.swing.plaf.windows.ClassicSortArrowIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1730
                null, new Object[] { Boolean.TRUE })));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1731
        table.put("Table.descendingSortIcon", new XPValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1732
            new SkinIcon(Part.HP_HEADERSORTARROW, State.SORTEDUP),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1733
            new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1734
                "sun.swing.plaf.windows.ClassicSortArrowIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1735
                null, new Object[] { Boolean.FALSE })));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1736
        /* END table handling for Vista */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1737
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1738
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1739
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1740
     * If we support loading of fonts from the desktop this will return
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1741
     * a DesktopProperty representing the font. If the font can't be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1742
     * represented in the current encoding this will return null and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1743
     * turn off the use of system fonts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1744
     */
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  1745
    private Object getDesktopFontValue(String fontName, Object backup) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1746
        if (useSystemFontSettings) {
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  1747
            return new WindowsFontProperty(fontName, backup);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1748
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1749
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1750
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1751
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1752
    // When a desktop property change is detected, these classes must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1753
    // reinitialized in the defaults table to ensure the classes reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1754
    // the updated desktop property values (colors mostly)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1755
    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1756
    private Object[] getLazyValueDefaults() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1757
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1758
        Object buttonBorder =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1759
            new XPBorderValue(Part.BP_PUSHBUTTON,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1760
                              new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1761
                               "javax.swing.plaf.basic.BasicBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1762
                               "getButtonBorder"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1763
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1764
        Object textFieldBorder =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1765
            new XPBorderValue(Part.EP_EDIT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1766
                              new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1767
                               "javax.swing.plaf.basic.BasicBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1768
                               "getTextFieldBorder"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1769
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1770
        Object textFieldMargin =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1771
            new XPValue(new InsetsUIResource(2, 2, 2, 2),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1772
                        new InsetsUIResource(1, 1, 1, 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1773
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1774
        Object spinnerBorder =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1775
            new XPBorderValue(Part.EP_EDIT, textFieldBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1776
                              new EmptyBorder(2, 2, 2, 2));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1777
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1778
        Object spinnerArrowInsets =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1779
            new XPValue(new InsetsUIResource(1, 1, 1, 1),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1780
                        null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1781
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1782
        Object comboBoxBorder = new XPBorderValue(Part.CP_COMBOBOX, textFieldBorder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1783
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1784
        // For focus rectangle for cells and trees.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1785
        Object focusCellHighlightBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1786
                          "com.sun.java.swing.plaf.windows.WindowsBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1787
                          "getFocusCellHighlightBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1788
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1789
        Object etchedBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1790
                          "javax.swing.plaf.BorderUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1791
                          "getEtchedBorderUIResource");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1792
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1793
        Object internalFrameBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1794
                "com.sun.java.swing.plaf.windows.WindowsBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1795
                "getInternalFrameBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1796
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1797
        Object loweredBevelBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1798
                          "javax.swing.plaf.BorderUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1799
                          "getLoweredBevelBorderUIResource");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1800
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1801
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1802
        Object marginBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1803
                            "javax.swing.plaf.basic.BasicBorders$MarginBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1804
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1805
        Object menuBarBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1806
                "javax.swing.plaf.basic.BasicBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1807
                "getMenuBarBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1808
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1809
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1810
        Object popupMenuBorder = new XPBorderValue(Part.MENU,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1811
                        new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1812
                          "javax.swing.plaf.basic.BasicBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1813
                          "getInternalFrameBorder"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1814
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1815
        // *** ProgressBar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1816
        Object progressBarBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1817
                              "com.sun.java.swing.plaf.windows.WindowsBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1818
                              "getProgressBarBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1819
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1820
        Object radioButtonBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1821
                               "javax.swing.plaf.basic.BasicBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1822
                               "getRadioButtonBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1823
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1824
        Object scrollPaneBorder =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1825
            new XPBorderValue(Part.LBP_LISTBOX, textFieldBorder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1826
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1827
        Object tableScrollPaneBorder =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1828
            new XPBorderValue(Part.LBP_LISTBOX, loweredBevelBorder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1829
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1830
        Object tableHeaderBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1831
                          "com.sun.java.swing.plaf.windows.WindowsBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1832
                          "getTableHeaderBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1833
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1834
        // *** ToolBar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1835
        Object toolBarBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1836
                              "com.sun.java.swing.plaf.windows.WindowsBorders",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1837
                              "getToolBarBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1838
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1839
        // *** ToolTips
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1840
        Object toolTipBorder = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1841
                              "javax.swing.plaf.BorderUIResource",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1842
                              "getBlackLineBorderUIResource");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1843
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1844
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1845
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1846
        Object checkBoxIcon = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1847
                     "com.sun.java.swing.plaf.windows.WindowsIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1848
                     "getCheckBoxIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1849
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1850
        Object radioButtonIcon = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1851
                     "com.sun.java.swing.plaf.windows.WindowsIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1852
                     "getRadioButtonIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1853
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1854
        Object radioButtonMenuItemIcon = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1855
                     "com.sun.java.swing.plaf.windows.WindowsIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1856
                     "getRadioButtonMenuItemIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1857
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1858
        Object menuItemCheckIcon = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1859
                     "com.sun.java.swing.plaf.windows.WindowsIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1860
                     "getMenuItemCheckIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1861
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1862
        Object menuItemArrowIcon = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1863
                     "com.sun.java.swing.plaf.windows.WindowsIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1864
                     "getMenuItemArrowIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1865
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1866
        Object menuArrowIcon = new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1867
                     "com.sun.java.swing.plaf.windows.WindowsIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1868
                     "getMenuArrowIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1869
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1870
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1871
        Object[] lazyDefaults = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1872
            "Button.border", buttonBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1873
            "CheckBox.border", radioButtonBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1874
            "ComboBox.border", comboBoxBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1875
            "DesktopIcon.border", internalFrameBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1876
            "FormattedTextField.border", textFieldBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1877
            "FormattedTextField.margin", textFieldMargin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1878
            "InternalFrame.border", internalFrameBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1879
            "List.focusCellHighlightBorder", focusCellHighlightBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1880
            "Table.focusCellHighlightBorder", focusCellHighlightBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1881
            "Menu.border", marginBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1882
            "MenuBar.border", menuBarBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1883
            "MenuItem.border", marginBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1884
            "PasswordField.border", textFieldBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1885
            "PasswordField.margin", textFieldMargin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1886
            "PopupMenu.border", popupMenuBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1887
            "ProgressBar.border", progressBarBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1888
            "RadioButton.border", radioButtonBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1889
            "ScrollPane.border", scrollPaneBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1890
            "Spinner.border", spinnerBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1891
            "Spinner.arrowButtonInsets", spinnerArrowInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1892
            "Spinner.arrowButtonSize", new Dimension(17, 9),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1893
            "Table.scrollPaneBorder", tableScrollPaneBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1894
            "TableHeader.cellBorder", tableHeaderBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1895
            "TextArea.margin", textFieldMargin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1896
            "TextField.border", textFieldBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1897
            "TextField.margin", textFieldMargin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1898
            "TitledBorder.border",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1899
                        new XPBorderValue(Part.BP_GROUPBOX, etchedBorder),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1900
            "ToggleButton.border", radioButtonBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1901
            "ToolBar.border", toolBarBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1902
            "ToolTip.border", toolTipBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1903
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1904
            "CheckBox.icon", checkBoxIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1905
            "Menu.arrowIcon", menuArrowIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1906
            "MenuItem.checkIcon", menuItemCheckIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1907
            "MenuItem.arrowIcon", menuItemArrowIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1908
            "RadioButton.icon", radioButtonIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1909
            "RadioButtonMenuItem.checkIcon", radioButtonMenuItemIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1910
            "InternalFrame.layoutTitlePaneAtOrigin",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1911
                        new XPValue(Boolean.TRUE, Boolean.FALSE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1912
            "Table.ascendingSortIcon", new XPValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1913
                  new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1914
                     "sun.swing.icon.SortArrowIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1915
                     null, new Object[] { Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1916
                                          "Table.sortIconColor" }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1917
                  new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1918
                      "sun.swing.plaf.windows.ClassicSortArrowIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1919
                      null, new Object[] { Boolean.TRUE })),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1920
            "Table.descendingSortIcon", new XPValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1921
                  new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1922
                     "sun.swing.icon.SortArrowIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1923
                     null, new Object[] { Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1924
                                          "Table.sortIconColor" }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1925
                  new SwingLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1926
                     "sun.swing.plaf.windows.ClassicSortArrowIcon",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1927
                     null, new Object[] { Boolean.FALSE })),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1928
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1929
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1930
        return lazyDefaults;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1931
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1932
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1933
    public void uninitialize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1934
        super.uninitialize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1935
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1936
        if (WindowsPopupMenuUI.mnemonicListener != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1937
            MenuSelectionManager.defaultManager().
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1938
                removeChangeListener(WindowsPopupMenuUI.mnemonicListener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1939
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1940
        KeyboardFocusManager.getCurrentKeyboardFocusManager().
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1941
            removeKeyEventPostProcessor(WindowsRootPaneUI.altProcessor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1942
        DesktopProperty.flushUnreferencedProperties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1943
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1944
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1945
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1946
    // Toggle flag for drawing the mnemonic state
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1947
    private static boolean isMnemonicHidden = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1948
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1949
    // Flag which indicates that the Win98/Win2k/WinME features
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1950
    // should be disabled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1951
    private static boolean isClassicWindows = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1952
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1953
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1954
     * Sets the state of the hide mnemonic flag. This flag is used by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1955
     * component UI delegates to determine if the mnemonic should be rendered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1956
     * This method is a non operation if the underlying operating system
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1957
     * does not support the mnemonic hiding feature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1958
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1959
     * @param hide true if mnemonics should be hidden
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1960
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1961
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1962
    public static void setMnemonicHidden(boolean hide) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1963
        if (UIManager.getBoolean("Button.showMnemonics") == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1964
            // Do not hide mnemonics if the UI defaults do not support this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1965
            isMnemonicHidden = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1966
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1967
            isMnemonicHidden = hide;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1968
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1969
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1970
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1971
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1972
     * Gets the state of the hide mnemonic flag. This only has meaning
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1973
     * if this feature is supported by the underlying OS.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1974
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1975
     * @return true if mnemonics are hidden, otherwise, false
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1976
     * @see #setMnemonicHidden
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1977
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1978
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1979
    public static boolean isMnemonicHidden() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1980
        if (UIManager.getBoolean("Button.showMnemonics") == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1981
            // Do not hide mnemonics if the UI defaults do not support this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1982
            isMnemonicHidden = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1983
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1984
        return isMnemonicHidden;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1985
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1986
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1987
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1988
     * Gets the state of the flag which indicates if the old Windows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1989
     * look and feel should be rendered. This flag is used by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1990
     * component UI delegates as a hint to determine which style the component
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1991
     * should be rendered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1992
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1993
     * @return true if Windows 95 and Windows NT 4 look and feel should
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1994
     *         be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1995
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1996
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1997
    public static boolean isClassicWindows() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1998
        return isClassicWindows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1999
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2000
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2001
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2002
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2003
     * Invoked when the user attempts an invalid operation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2004
     * such as pasting into an uneditable <code>JTextField</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2005
     * that has focus.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2006
     * </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2007
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2008
     * If the user has enabled visual error indication on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2009
     * the desktop, this method will flash the caption bar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2010
     * of the active window. The user can also set the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2011
     * property awt.visualbell=true to achieve the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2012
     * results.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2013
     * </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2014
     *
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 15315
diff changeset
  2015
     * @param component Component the error occurred in, may be
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2016
     *                  null indicating the error condition is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2017
     *                  not directly associated with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2018
     *                  <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2019
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2020
     * @see javax.swing.LookAndFeel#provideErrorFeedback
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2021
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2022
     public void provideErrorFeedback(Component component) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2023
         super.provideErrorFeedback(component);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2024
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2025
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2026
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2027
     * {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2028
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2029
    public LayoutStyle getLayoutStyle() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2030
        LayoutStyle style = this.style;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2031
        if (style == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2032
            style = new WindowsLayoutStyle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2033
            this.style = style;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2034
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2035
        return style;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2036
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2037
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2038
    // ********* Auditory Cue support methods and objects *********
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2039
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2040
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2041
     * Returns an <code>Action</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2042
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2043
     * This Action contains the information and logic to render an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2044
     * auditory cue. The <code>Object</code> that is passed to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2045
     * method contains the information needed to render the auditory
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2046
     * cue. Normally, this <code>Object</code> is a <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2047
     * that points to a <code>Toolkit</code> <code>desktopProperty</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2048
     * This <code>desktopProperty</code> is resolved by AWT and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2049
     * Windows OS.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2050
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2051
     * This <code>Action</code>'s <code>actionPerformed</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2052
     * is fired by the <code>playSound</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2053
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2054
     * @return      an Action which knows how to render the auditory
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2055
     *              cue for one particular system or user activity
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2056
     * @see #playSound(Action)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2057
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2058
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2059
    protected Action createAudioAction(Object key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2060
        if (key != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2061
            String audioKey = (String)key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2062
            String audioValue = (String)UIManager.get(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2063
            return new AudioAction(audioKey, audioValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2064
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2065
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2066
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2067
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2068
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2069
    static void repaintRootPane(Component c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2070
        JRootPane root = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2071
        for (; c != null; c = c.getParent()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2072
            if (c instanceof JRootPane) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2073
                root = (JRootPane)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2074
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2075
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2076
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2077
        if (root != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2078
            root.repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2079
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2080
            c.repaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2081
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2082
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2083
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2084
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2085
     * Pass the name String to the super constructor. This is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2086
     * later to identify the Action and decide whether to play it or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2087
     * not. Store the resource String. It is used to get the audio
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2088
     * resource. In this case, the resource is a <code>Runnable</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2089
     * supplied by <code>Toolkit</code>. This <code>Runnable</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2090
     * effectively a pointer down into the Win32 OS that knows how to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2091
     * play the right sound.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2092
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2093
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2094
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2095
    private static class AudioAction extends AbstractAction {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2096
        private Runnable audioRunnable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2097
        private String audioResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2098
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2099
         * We use the String as the name of the Action and as a pointer to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2100
         * the underlying OSes audio resource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2101
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2102
        public AudioAction(String name, String resource) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2103
            super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2104
            audioResource = resource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2105
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2106
        public void actionPerformed(ActionEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2107
            if (audioRunnable == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2108
                audioRunnable = (Runnable)Toolkit.getDefaultToolkit().getDesktopProperty(audioResource);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2109
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2110
            if (audioRunnable != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2111
                // Runnable appears to block until completed playing, hence
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2112
                // start up another thread to handle playing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2113
                new Thread(audioRunnable).start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2114
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2115
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2116
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2117
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2119
     * Gets an <code>Icon</code> from the native libraries if available,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2120
     * otherwise gets it from an image resource file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2122
    private static class LazyWindowsIcon implements UIDefaults.LazyValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2123
        private String nativeImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2124
        private String resource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2125
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2126
        LazyWindowsIcon(String nativeImage, String resource) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2127
            this.nativeImage = nativeImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2128
            this.resource = resource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2129
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2130
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2131
        public Object createValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2132
            if (nativeImage != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2133
                Image image = (Image)ShellFolder.get(nativeImage);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2134
                if (image != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2135
                    return new ImageIcon(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2136
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2137
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2138
            return SwingUtilities2.makeIcon(getClass(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2139
                                            WindowsLookAndFeel.class,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2140
                                            resource);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2141
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2143
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2144
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2146
     * Gets an <code>Icon</code> from the native libraries if available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2147
     * A desktop property is used to trigger reloading the icon when needed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2148
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2149
    private class ActiveWindowsIcon implements UIDefaults.ActiveValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2150
        private Icon icon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2151
        private String nativeImageName;
1847
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2152
        private String fallbackName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2153
        private DesktopProperty desktopProperty;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2154
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2155
        ActiveWindowsIcon(String desktopPropertyName,
1847
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2156
                            String nativeImageName, String fallbackName) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2157
            this.nativeImageName = nativeImageName;
1847
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2158
            this.fallbackName = fallbackName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2159
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2160
            if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2161
                    OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_XP) < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2162
                // This desktop property is needed to trigger reloading the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2163
                // It is kept in member variable to avoid GC.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2164
                this.desktopProperty = new TriggerDesktopProperty(desktopPropertyName) {
1847
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2165
                    @Override protected void updateUI() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2166
                        icon = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2167
                        super.updateUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2168
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2169
                };
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2170
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2171
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2172
1847
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2173
        @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2174
        public Object createValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2175
            if (icon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2176
                Image image = (Image)ShellFolder.get(nativeImageName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2177
                if (image != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2178
                    icon = new ImageIconUIResource(image);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2179
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2180
            }
1847
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2181
            if (icon == null && fallbackName != null) {
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2182
                UIDefaults.LazyValue fallback = (UIDefaults.LazyValue)
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2183
                        SwingUtilities2.makeIcon(WindowsLookAndFeel.class,
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2184
                            BasicLookAndFeel.class, fallbackName);
ead8e9499c20 6792401: Windows LAF: ActiveWindowsIcon should not be greedy with fallback icon
peterz
parents: 715
diff changeset
  2185
                icon = (Icon) fallback.createValue(table);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2186
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2187
            return icon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2188
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2190
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2191
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2192
     * Icon backed-up by XP Skin.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2194
    private static class SkinIcon implements Icon, UIResource {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2195
        private final Part part;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2196
        private final State state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2197
        SkinIcon(Part part, State state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2198
            this.part = part;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2199
            this.state = state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2200
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2201
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2202
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2203
         * Draw the icon at the specified location.  Icon implementations
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2204
         * may use the Component argument to get properties useful for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2205
         * painting, e.g. the foreground or background color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2206
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2207
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2208
            XPStyle xp = XPStyle.getXP();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2209
            assert xp != null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2210
            if (xp != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2211
                Skin skin = xp.getSkin(null, part);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2212
                skin.paintSkin(g, x, y, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2213
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2214
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2215
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2216
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2217
         * Returns the icon's width.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2218
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2219
         * @return an int specifying the fixed width of the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2220
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2221
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2222
            int width = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2223
            XPStyle xp = XPStyle.getXP();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2224
            assert xp != null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2225
            if (xp != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2226
                Skin skin = xp.getSkin(null, part);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2227
                width = skin.getWidth();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2228
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2229
            return width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2231
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2232
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2233
         * Returns the icon's height.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2234
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2235
         * @return an int specifying the fixed height of the icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2236
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2237
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2238
            int height = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2239
            XPStyle xp = XPStyle.getXP();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2240
            if (xp != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2241
                Skin skin = xp.getSkin(null, part);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2242
                height = skin.getHeight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2243
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2244
            return height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2245
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2246
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2248
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2249
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2250
     * DesktopProperty for fonts. If a font with the name 'MS Sans Serif'
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2251
     * is returned, it is mapped to 'Microsoft Sans Serif'.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2252
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2253
    private static class WindowsFontProperty extends DesktopProperty {
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  2254
        WindowsFontProperty(String key, Object backup) {
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  2255
            super(key, backup);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2256
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2257
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2258
        public void invalidate(LookAndFeel laf) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2259
            if ("win.defaultGUI.font.height".equals(getKey())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2260
                ((WindowsLookAndFeel)laf).style = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2261
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2262
            super.invalidate(laf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2263
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2264
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2265
        protected Object configureValue(Object value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2266
            if (value instanceof Font) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2267
                Font font = (Font)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2268
                if ("MS Sans Serif".equals(font.getName())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2269
                    int size = font.getSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2270
                    // 4950968: Workaround to mimic the way Windows maps the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2271
                    // font size of 6 pts to the smallest available bitmap font size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2272
                    // This happens mostly on Win 98/Me & NT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2273
                    int dpi;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2274
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2275
                        dpi = Toolkit.getDefaultToolkit().getScreenResolution();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2276
                    } catch (HeadlessException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2277
                        dpi = 96;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2278
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2279
                    if (Math.round(size * 72F / dpi) < 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2280
                        size = Math.round(8 * dpi / 72F);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2281
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2282
                    Font msFont = new FontUIResource("Microsoft Sans Serif",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2283
                                          font.getStyle(), size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2284
                    if (msFont.getName() != null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2285
                        msFont.getName().equals(msFont.getFamily())) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2286
                        font = msFont;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2287
                    } else if (size != font.getSize()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2288
                        font = new FontUIResource("MS Sans Serif",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2289
                                                  font.getStyle(), size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2290
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2291
                }
3928
be186a33df9b 6795908: Refactor FontManager
rkennke
parents: 2658
diff changeset
  2292
be186a33df9b 6795908: Refactor FontManager
rkennke
parents: 2658
diff changeset
  2293
                if (FontUtilities.fontSupportsDefaultEncoding(font)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2294
                    if (!(font instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2295
                        font = new FontUIResource(font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2296
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2297
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2298
                else {
3928
be186a33df9b 6795908: Refactor FontManager
rkennke
parents: 2658
diff changeset
  2299
                    font = FontUtilities.getCompositeFontUIResource(font);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2300
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2301
                return font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2302
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2303
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2304
            return super.configureValue(value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2305
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2306
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2307
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2308
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2309
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2310
     * DesktopProperty for fonts that only gets sizes from the desktop,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2311
     * font name and style are passed into the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2312
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2313
    private static class WindowsFontSizeProperty extends DesktopProperty {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2314
        private String fontName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2315
        private int fontSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2316
        private int fontStyle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2317
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  2318
        WindowsFontSizeProperty(String key, String fontName,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2319
                                int fontStyle, int fontSize) {
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  2320
            super(key, null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2321
            this.fontName = fontName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2322
            this.fontSize = fontSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2323
            this.fontStyle = fontStyle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2324
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2325
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2326
        protected Object configureValue(Object value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2327
            if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2328
                value = new FontUIResource(fontName, fontStyle, fontSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2329
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2330
            else if (value instanceof Integer) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2331
                value = new FontUIResource(fontName, fontStyle,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2332
                                           ((Integer)value).intValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2333
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2334
            return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2335
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2336
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2337
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2338
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2339
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2340
     * A value wrapper that actively retrieves values from xp or falls back
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2341
     * to the classic value if not running XP styles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2342
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2343
    private static class XPValue implements UIDefaults.ActiveValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2344
        protected Object classicValue, xpValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2345
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2346
        // A constant that lets you specify null when using XP styles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2347
        private final static Object NULL_VALUE = new Object();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2348
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2349
        XPValue(Object xpValue, Object classicValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2350
            this.xpValue = xpValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2351
            this.classicValue = classicValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2352
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2353
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2354
        public Object createValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2355
            Object value = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2356
            if (XPStyle.getXP() != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2357
                value = getXPValue(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2358
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2359
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2360
            if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2361
                value = getClassicValue(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2362
            } else if (value == NULL_VALUE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2363
                value = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2364
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2365
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2366
            return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2367
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2368
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2369
        protected Object getXPValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2370
            return recursiveCreateValue(xpValue, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2371
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2372
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2373
        protected Object getClassicValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2374
            return recursiveCreateValue(classicValue, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2375
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2376
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2377
        private Object recursiveCreateValue(Object value, UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2378
            if (value instanceof UIDefaults.LazyValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2379
                value = ((UIDefaults.LazyValue)value).createValue(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2380
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2381
            if (value instanceof UIDefaults.ActiveValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2382
                return ((UIDefaults.ActiveValue)value).createValue(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2383
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2384
                return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2385
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2386
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2387
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2388
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2389
    private static class XPBorderValue extends XPValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2390
        private final Border extraMargin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2391
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2392
        XPBorderValue(Part xpValue, Object classicValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2393
            this(xpValue, classicValue, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2394
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2395
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2396
        XPBorderValue(Part xpValue, Object classicValue, Border extraMargin) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2397
            super(xpValue, classicValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2398
            this.extraMargin = extraMargin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2399
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2400
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2401
        public Object getXPValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2402
            Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2403
            if (extraMargin != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2404
                return new BorderUIResource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2405
                        CompoundBorderUIResource(xpBorder, extraMargin);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2406
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2407
                return xpBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2408
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2409
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2410
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2411
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2412
    private static class XPColorValue extends XPValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2413
        XPColorValue(Part part, State state, Prop prop, Object classicValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2414
            super(new XPColorValueKey(part, state, prop), classicValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2415
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2416
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2417
        public Object getXPValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2418
            XPColorValueKey key = (XPColorValueKey)xpValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2419
            return XPStyle.getXP().getColor(key.skin, key.prop, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2420
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2421
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2422
        private static class XPColorValueKey {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2423
            Skin skin;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2424
            Prop prop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2425
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2426
            XPColorValueKey(Part part, State state, Prop prop) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2427
                this.skin = new Skin(part, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2428
                this.prop = prop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2429
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2430
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2431
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2432
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2433
    private class XPDLUValue extends XPValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2434
        private int direction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2435
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2436
        XPDLUValue(int xpdlu, int classicdlu, int direction) {
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  2437
            super(Integer.valueOf(xpdlu), Integer.valueOf(classicdlu));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2438
            this.direction = direction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2439
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2440
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2441
        public Object getXPValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2442
            int px = dluToPixels(((Integer)xpValue).intValue(), direction);
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  2443
            return Integer.valueOf(px);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2444
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2445
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2446
        public Object getClassicValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2447
            int px = dluToPixels(((Integer)classicValue).intValue(), direction);
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  2448
            return Integer.valueOf(px);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2449
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2450
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2451
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2452
    private class TriggerDesktopProperty extends DesktopProperty {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2453
        TriggerDesktopProperty(String key) {
3732
a4009b9b2f65 6824600: OOM occurs when setLookAndFeel() is executed in Windows L&F(XP style)
rupashka
parents: 2658
diff changeset
  2454
            super(key, null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2455
            // This call adds a property change listener for the property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2456
            // which triggers a call to updateUI(). The value returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2457
            // is not interesting here.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2458
            getValueFromDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2459
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2460
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2461
        protected void updateUI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2462
            super.updateUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2463
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2464
            // Make sure property change listener is readded each time
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2465
            getValueFromDesktop();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2466
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2467
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2468
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2469
    private class FontDesktopProperty extends TriggerDesktopProperty {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2470
        FontDesktopProperty(String key) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2471
            super(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2472
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2473
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2474
        protected void updateUI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2475
            Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2476
            UIDefaults defaults = UIManager.getLookAndFeelDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2477
            defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2478
            super.updateUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2479
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2480
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2481
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2482
    // Windows LayoutStyle.  From:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2483
    // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2484
    private class WindowsLayoutStyle extends DefaultLayoutStyle {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2485
        @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2486
        public int getPreferredGap(JComponent component1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2487
                JComponent component2, ComponentPlacement type, int position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2488
                Container parent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2489
            // Checks args
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2490
            super.getPreferredGap(component1, component2, type, position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2491
                                  parent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2492
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2493
            switch(type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2494
            case INDENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2495
                // Windows doesn't spec this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2496
                if (position == SwingConstants.EAST ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2497
                        position == SwingConstants.WEST) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2498
                    int indent = getIndent(component1, position);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2499
                    if (indent > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2500
                        return indent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2501
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2502
                    return 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2503
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2504
                // Fall through to related.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2505
            case RELATED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2506
                if (isLabelAndNonlabel(component1, component2, position)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2507
                    // Between text labels and their associated controls (for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2508
                    // example, text boxes and list boxes): 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2509
                    // NOTE: We're not honoring:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2510
                    // 'Text label beside a button 3 down from the top of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2511
                    // the button,' but I suspect that is an attempt to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2512
                    // enforce a baseline layout which will be handled
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2513
                    // separately.  In order to enforce this we would need
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2514
                    // this API to return a more complicated type (Insets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2515
                    // or something else).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2516
                    return getButtonGap(component1, component2, position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2517
                                        dluToPixels(3, position));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2518
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2519
                // Between related controls: 4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2520
                return getButtonGap(component1, component2, position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2521
                                    dluToPixels(4, position));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2522
            case UNRELATED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2523
                // Between unrelated controls: 7
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2524
                return getButtonGap(component1, component2, position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2525
                                    dluToPixels(7, position));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2526
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2527
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2528
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2529
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2530
        @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2531
        public int getContainerGap(JComponent component, int position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2532
                                   Container parent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2533
            // Checks args
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2534
            super.getContainerGap(component, position, parent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2535
            return getButtonGap(component, position, dluToPixels(7, position));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2536
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2537
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2538
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2539
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2540
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2541
     * Converts the dialog unit argument to pixels along the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2542
     * axis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2543
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2544
    private int dluToPixels(int dlu, int direction) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2545
        if (baseUnitX == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2546
            calculateBaseUnits();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2547
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2548
        if (direction == SwingConstants.EAST ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2549
            direction == SwingConstants.WEST) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2550
            return dlu * baseUnitX / 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2551
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2552
        assert (direction == SwingConstants.NORTH ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2553
                direction == SwingConstants.SOUTH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2554
        return dlu * baseUnitY / 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2555
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2556
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2557
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2558
     * Calculates the dialog unit mapping.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2559
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2560
    private void calculateBaseUnits() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2561
        // This calculation comes from:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2562
        // http://support.microsoft.com/default.aspx?scid=kb;EN-US;125681
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2563
        FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2564
                UIManager.getFont("Button.font"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2565
        baseUnitX = metrics.stringWidth(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2566
                "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2567
        baseUnitX = (baseUnitX / 26 + 1) / 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2568
        // The -1 comes from experimentation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2569
        baseUnitY = metrics.getAscent() + metrics.getDescent() - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2570
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2571
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2572
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2573
     * {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2574
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2575
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2576
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2577
    public Icon getDisabledIcon(JComponent component, Icon icon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2578
        // if the component has a HI_RES_DISABLED_ICON_CLIENT_KEY
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2579
        // client property set to Boolean.TRUE, then use the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2580
        // hi res algorithm for creating the disabled icon (used
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2581
        // in particular by the WindowsFileChooserUI class)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2582
        if (icon != null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2583
                && component != null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2584
                && Boolean.TRUE.equals(component.getClientProperty(HI_RES_DISABLED_ICON_CLIENT_KEY))
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2585
                && icon.getIconWidth() > 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2586
                && icon.getIconHeight() > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2587
            BufferedImage img = new BufferedImage(icon.getIconWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2588
                    icon.getIconWidth(), BufferedImage.TYPE_INT_ARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2589
            icon.paintIcon(component, img.getGraphics(), 0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2590
            ImageFilter filter = new RGBGrayFilter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2591
            ImageProducer producer = new FilteredImageSource(img.getSource(), filter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2592
            Image resultImage = component.createImage(producer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2593
            return new ImageIconUIResource(resultImage);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2594
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2595
        return super.getDisabledIcon(component, icon);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2596
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2597
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2598
    private static class RGBGrayFilter extends RGBImageFilter {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2599
        public RGBGrayFilter() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2600
            canFilterIndexColorModel = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2601
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2602
        public int filterRGB(int x, int y, int rgb) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2603
            // find the average of red, green, and blue
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2604
            float avg = (((rgb >> 16) & 0xff) / 255f +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2605
                          ((rgb >>  8) & 0xff) / 255f +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2606
                           (rgb        & 0xff) / 255f) / 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2607
            // pull out the alpha channel
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2608
            float alpha = (((rgb>>24)&0xff)/255f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2609
            // calc the average
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2610
            avg = Math.min(1.0f, (1f-avg)/(100.0f/35.0f) + avg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2611
            // turn back into rgb
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2612
            int rgbval = (int)(alpha * 255f) << 24 |
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2613
                         (int)(avg   * 255f) << 16 |
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2614
                         (int)(avg   * 255f) <<  8 |
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2615
                         (int)(avg   * 255f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2616
            return rgbval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2617
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2618
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2619
11975
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2620
    private static class FocusColorProperty extends DesktopProperty {
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2621
        public FocusColorProperty () {
15315
9db01c15ae0c 7166409: bug4331515.java fail with NullPointerException on ubuntu10.04-x86 for JDK8
alexsch
parents: 13779
diff changeset
  2622
            // Fallback value is never used because of the configureValue method doesn't return null
11975
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2623
            super("win.3d.backgroundColor", Color.BLACK);
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2624
        }
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2625
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2626
        @Override
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2627
        protected Object configureValue(Object value) {
15315
9db01c15ae0c 7166409: bug4331515.java fail with NullPointerException on ubuntu10.04-x86 for JDK8
alexsch
parents: 13779
diff changeset
  2628
            Object highContrastOn = Toolkit.getDefaultToolkit().
9db01c15ae0c 7166409: bug4331515.java fail with NullPointerException on ubuntu10.04-x86 for JDK8
alexsch
parents: 13779
diff changeset
  2629
                    getDesktopProperty("win.highContrast.on");
9db01c15ae0c 7166409: bug4331515.java fail with NullPointerException on ubuntu10.04-x86 for JDK8
alexsch
parents: 13779
diff changeset
  2630
            if (highContrastOn == null || !((Boolean) highContrastOn).booleanValue()) {
11975
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2631
                return Color.BLACK;
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2632
            }
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2633
            return Color.BLACK.equals(value) ? Color.WHITE : Color.BLACK;
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2634
        }
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2635
    }
d3620e28371c 7089914: Focus on image icons are not visible in javaws cache with high contrast mode
rupashka
parents: 10413
diff changeset
  2636
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2637
}