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