jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java
author prr
Fri, 22 Jul 2016 16:09:52 -0700
changeset 40140 ddb766940954
parent 37714 7a0b1c7e7054
child 41008 726399082620
permissions -rw-r--r--
8162429: Clean up obsolete font preferences for JDS. Reviewed-by: bpb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
37711
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
     2
 * Copyright (c) 2002, 2016, 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: 3106
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: 3106
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: 3106
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3106
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3106
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
package com.sun.java.swing.plaf.gtk;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.beans.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.lang.ref.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.security.PrivilegedAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.Locale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.swing.colorchooser.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import javax.swing.plaf.synth.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import javax.swing.text.DefaultEditorKit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import com.sun.java.swing.plaf.gtk.GTKConstants.PositionType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import com.sun.java.swing.plaf.gtk.GTKConstants.StateType;
32485
e00f713e6103 6302464: Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
alexsch
parents: 30940
diff changeset
    43
import java.util.HashMap;
e00f713e6103 6302464: Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
alexsch
parents: 30940
diff changeset
    44
import java.util.Map;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import sun.awt.SunToolkit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import sun.awt.UNIXToolkit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import sun.awt.OSInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import sun.security.action.GetPropertyAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import sun.swing.DefaultLayoutStyle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import sun.swing.SwingUtilities2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @author Scott Violet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 */
23632
cd7a34d12e8c 8033908: Fix serial lint warnings in com.sun.java.swing.plaf
darcy
parents: 23612
diff changeset
    55
@SuppressWarnings("serial") // Superclass not serializable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
public class GTKLookAndFeel extends SynthLookAndFeel {
37711
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
    57
    private static boolean IS_22;
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
    58
    private static boolean IS_3;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * Whether or not text is drawn antialiased.  This keys off the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * desktop property 'gnome.Xft/Antialias' and 'gnome.Xft/RGBA'
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * We should assume ON - or some variation of ON as no GTK desktop
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * ships with it OFF.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     */
32485
e00f713e6103 6302464: Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
alexsch
parents: 30940
diff changeset
    66
    static Map<Object, Object> aaTextInfo;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Used to override if system (desktop) text anti-aliasing settings should
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * be used. The reasons for this are are is that currently its "off"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * for CJK locales which is not likely to be a good universal answer, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * also its off for remote display. So this provides an unsupported
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * way to explicitly request that it be "on".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    private static boolean gtkAAFontSettingsCond;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Font to use in places where there is no widget.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    private Font fallbackFont;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * If true, GTKLookAndFeel is inside the <code>initialize</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    private boolean inInitialize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * If true, PropertyChangeListeners have been installed for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Toolkit.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    private boolean pclInstalled;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * StyleFactory needs to be created only the first time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    private GTKStyleFactory styleFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * Cached theme name. Used by GTKGraphicsUtils
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    private static String gtkThemeName = "Default";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * Returns true if running on system containing at least 2.2.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    static boolean is2_2() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        // NOTE: We're currently hard coding to use 2.2.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        // If we want to support both GTK 2.0 and 2.2, we'll
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        // need to get the major/minor/micro version from the .so.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        // Refer to bug 4912613 for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        return IS_22;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
37711
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
   115
    static boolean is3() {
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
   116
        return IS_3;
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
   117
    }
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
   118
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * Maps a swing constant to a GTK constant.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    static PositionType SwingOrientationConstantToGTK(int side) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        switch (side) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        case SwingConstants.LEFT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            return PositionType.LEFT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        case SwingConstants.RIGHT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            return PositionType.RIGHT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        case SwingConstants.TOP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            return PositionType.TOP;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        case SwingConstants.BOTTOM:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            return PositionType.BOTTOM;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        assert false : "Unknown orientation: " + side;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        return PositionType.TOP;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * Maps from Synth state to native GTK state using typesafe enumeration
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * StateType.  This is only used by GTKEngine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    static StateType synthStateToGTKStateType(int state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        StateType result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        switch (state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            case SynthConstants.PRESSED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                result = StateType.ACTIVE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            case SynthConstants.MOUSE_OVER:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                result = StateType.PRELIGHT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            case SynthConstants.SELECTED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                result = StateType.SELECTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            case SynthConstants.DISABLED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                result = StateType.INSENSITIVE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            case SynthConstants.ENABLED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                result = StateType.NORMAL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * Maps from a Synth state to the corresponding GTK state.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * The GTK states are named differently than Synth's states, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * following gives the mapping:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * <table><tr><td>Synth<td>GTK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * <tr><td>SynthConstants.PRESSED<td>ACTIVE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * <tr><td>SynthConstants.SELECTED<td>SELECTED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * <tr><td>SynthConstants.MOUSE_OVER<td>PRELIGHT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * <tr><td>SynthConstants.DISABLED<td>INSENSITIVE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * <tr><td>SynthConstants.ENABLED<td>NORMAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * Additionally some widgets are special cased.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    static int synthStateToGTKState(Region region, int state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        if ((state & SynthConstants.PRESSED) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            if (region == Region.RADIO_BUTTON
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                    || region == Region.CHECK_BOX
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                    || region == Region.MENU
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                    || region == Region.MENU_ITEM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                    || region == Region.RADIO_BUTTON_MENU_ITEM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                    || region == Region.CHECK_BOX_MENU_ITEM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                    || region == Region.SPLIT_PANE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                state = SynthConstants.MOUSE_OVER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                state = SynthConstants.PRESSED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        } else if (region == Region.TABBED_PANE_TAB) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            if ((state & SynthConstants.DISABLED) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                state = SynthConstants.DISABLED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            else if ((state & SynthConstants.SELECTED) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                state = SynthConstants.ENABLED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                state = SynthConstants.PRESSED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        } else if ((state & SynthConstants.SELECTED) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            if (region == Region.MENU) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                state = SynthConstants.MOUSE_OVER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            } else if (region == Region.RADIO_BUTTON ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                          region == Region.TOGGLE_BUTTON ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                          region == Region.RADIO_BUTTON_MENU_ITEM ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                          region == Region.CHECK_BOX_MENU_ITEM ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                          region == Region.CHECK_BOX ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                          region == Region.BUTTON) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                if ((state & SynthConstants.DISABLED) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                    state = SynthConstants.DISABLED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                // If the button is SELECTED and is PRELIGHT we need to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                // make the state MOUSE_OVER otherwise we don't paint the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                // PRELIGHT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                else if ((state & SynthConstants.MOUSE_OVER) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                    state = SynthConstants.MOUSE_OVER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                    state = SynthConstants.PRESSED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                state = SynthConstants.SELECTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        else if ((state & SynthConstants.MOUSE_OVER) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            state = SynthConstants.MOUSE_OVER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        else if ((state & SynthConstants.DISABLED) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            state = SynthConstants.DISABLED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            if (region == Region.SLIDER_TRACK) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                state = SynthConstants.PRESSED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                state = SynthConstants.ENABLED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        return state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    static boolean isText(Region region) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        // These Regions treat FOREGROUND as TEXT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        return (region == Region.TEXT_FIELD ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                region == Region.FORMATTED_TEXT_FIELD ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                region == Region.LIST ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                region == Region.PASSWORD_FIELD ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                region == Region.SPINNER ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                region == Region.TABLE ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                region == Region.TEXT_AREA ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                region == Region.TEXT_FIELD ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                region == Region.TEXT_PANE ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                region == Region.TREE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    public UIDefaults getDefaults() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        // We need to call super for basic's properties file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        UIDefaults table = super.getDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        // SynthTabbedPaneUI supports rollover on tabs, GTK does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        table.put("TabbedPane.isTabRollover", Boolean.FALSE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        // Prevents Synth from setting text AA by itself
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        table.put("Synth.doNotSetTextAA", true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        initResourceBundle(table);
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 15316
diff changeset
   267
        // For compatibility with apps expecting certain defaults we'll
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        // populate the table with the values from basic.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        initSystemColorDefaults(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        initComponentDefaults(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        installPropertyChangeListeners();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        return table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    private void installPropertyChangeListeners() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        if(!pclInstalled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            Toolkit kit = Toolkit.getDefaultToolkit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            WeakPCL pcl = new WeakPCL(this, kit, "gnome.Net/ThemeName");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            kit.addPropertyChangeListener(pcl.getKey(), pcl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
            pcl = new WeakPCL(this, kit, "gnome.Gtk/FontName");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            kit.addPropertyChangeListener(pcl.getKey(), pcl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
            pcl = new WeakPCL(this, kit, "gnome.Xft/DPI");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            kit.addPropertyChangeListener(pcl.getKey(), pcl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
            flushUnreferenced();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            pclInstalled = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    }
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.gtk.resources.gtk");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    protected void initComponentDefaults(UIDefaults table) {
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 15316
diff changeset
   295
        // For compatibility with apps expecting certain defaults we'll
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        // populate the table with the values from basic.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        super.initComponentDefaults(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
23612
bac7b20c12f4 8035313: Change SwingLazyValue usage to lambda
alexsch
parents: 23010
diff changeset
   299
        UIDefaults.LazyValue zeroBorder =
bac7b20c12f4 8035313: Change SwingLazyValue usage to lambda
alexsch
parents: 23010
diff changeset
   300
            t -> new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0);
bac7b20c12f4 8035313: Change SwingLazyValue usage to lambda
alexsch
parents: 23010
diff changeset
   301
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        Object focusBorder = new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            "com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            "getUnselectedCellBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        Object focusSelectedBorder = new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            "com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            "getSelectedCellBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        Object noFocusBorder = new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
            "com.sun.java.swing.plaf.gtk.GTKPainter$ListTableFocusBorder",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
            "getNoFocusCellBorder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        GTKStyle tableStyle = (GTKStyle)factory.getStyle(null, Region.TREE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        Color tableBg = tableStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                GTKColorType.TEXT_BACKGROUND);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        Color tableFocusCellBg = tableStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                GTKColorType.BACKGROUND);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        Color tableFocusCellFg = tableStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                GTKColorType.FOREGROUND);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        // The following progress bar size calculations come from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        // gtkprogressbar.c (version 2.8.20), see MIN_* constants and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        // the gtk_progress_bar_size_request() method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        GTKStyle progStyle = (GTKStyle)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            factory.getStyle(null, Region.PROGRESS_BAR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        int progXThickness = progStyle.getXThickness();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        int progYThickness = progStyle.getYThickness();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        int hProgWidth  = 150 - (progXThickness * 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        int hProgHeight =  20 - (progYThickness * 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        int vProgWidth  =  22 - (progXThickness * 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        int vProgHeight =  80 - (progYThickness * 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
30940
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   333
        Integer caretBlinkRate;
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   334
        if (Boolean.FALSE.equals(GTKEngine.INSTANCE.getSetting(
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   335
                GTKEngine.Settings.GTK_CURSOR_BLINK))) {
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   336
            caretBlinkRate = Integer.valueOf(0);
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   337
        } else {
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   338
            caretBlinkRate = (Integer) GTKEngine.INSTANCE.getSetting(
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   339
                    GTKEngine.Settings.GTK_CURSOR_BLINK_TIME);
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   340
            if (caretBlinkRate == null) {
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   341
                caretBlinkRate = Integer.valueOf(500);
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   342
            }
c9cc8b90d4d7 6260348: GTK+ L&F JTextComponent not respecting desktop caret blink rate
ssadetsky
parents: 25859
diff changeset
   343
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        Insets zeroInsets = new InsetsUIResource(0, 0, 0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
37714
7a0b1c7e7054 8154213: clean up uses of boxed primitive constructors in the java.desktop module
prr
parents: 37711
diff changeset
   346
        Double defaultCaretAspectRatio = Double.valueOf(0.025);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        Color caretColor = table.getColor("caretColor");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        Color controlText = table.getColor("controlText");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                       "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                       "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                       "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
                         "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
                        "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                          "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
               "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
                 "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
                 "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
                   "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                  "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
               "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
                    "ctrl LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
                 "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
                   "ctrl RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
              "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
           "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
             "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
          "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                       "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                         "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                          "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                   "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                    "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                   "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
             "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                       "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                       "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
                  "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
              "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
                        "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                         "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                     "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
                      "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
                        "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
              "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
               "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
            });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        Object passwordInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
                       "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
                       "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
                       "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                         "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                        "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                          "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
               "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                 "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
                 "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
                   "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
                "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
                  "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
               "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
                    "ctrl LEFT", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
                 "ctrl KP_LEFT", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
                   "ctrl RIGHT", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                "ctrl KP_RIGHT", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
              "ctrl shift LEFT", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
           "ctrl shift KP_LEFT", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
             "ctrl shift RIGHT", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
          "ctrl shift KP_RIGHT", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                       "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
                         "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
                          "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                   "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                    "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                   "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
             "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                       "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                       "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
                        "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
                         "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                     "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                      "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                        "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
              "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
               "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
            });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        Object editorMargin = new InsetsUIResource(3,3,3,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                           "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                           "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                           "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                             "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                              "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                   "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                     "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                     "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
                       "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                      "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
                   "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                        "ctrl LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                     "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                       "ctrl RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
                    "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
                  "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
               "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
                 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
              "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                           "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                             "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                              "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                       "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
                        "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
                               "UP", DefaultEditorKit.upAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
                            "KP_UP", DefaultEditorKit.upAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
                             "DOWN", DefaultEditorKit.downAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
                          "KP_DOWN", DefaultEditorKit.downAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
                          "PAGE_UP", DefaultEditorKit.pageUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
                        "PAGE_DOWN", DefaultEditorKit.pageDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
                    "shift PAGE_UP", "selection-page-up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
                  "shift PAGE_DOWN", "selection-page-down",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
               "ctrl shift PAGE_UP", "selection-page-left",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
             "ctrl shift PAGE_DOWN", "selection-page-right",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
                         "shift UP", DefaultEditorKit.selectionUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
                      "shift KP_UP", DefaultEditorKit.selectionUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
                       "shift DOWN", DefaultEditorKit.selectionDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                    "shift KP_DOWN", DefaultEditorKit.selectionDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
                            "ENTER", DefaultEditorKit.insertBreakAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
                 "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
                           "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
                      "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
                  "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
                            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
                             "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
                         "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
                          "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                              "TAB", DefaultEditorKit.insertTabAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
                  "ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                        "ctrl HOME", DefaultEditorKit.beginAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                         "ctrl END", DefaultEditorKit.endAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
                  "ctrl shift HOME", DefaultEditorKit.selectionBeginAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                   "ctrl shift END", DefaultEditorKit.selectionEndAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
                           "ctrl T", "next-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
                     "ctrl shift T", "previous-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
                       "ctrl SPACE", "activate-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
                   "control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
            });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        class FontLazyValue implements UIDefaults.LazyValue {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
            private Region region;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            FontLazyValue(Region region) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
                this.region = region;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
            public Object createValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
                GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
                GTKStyle style = (GTKStyle)factory.getStyle(null, region);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
                return style.getFontForState(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        Object[] defaults = new Object[] {
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   512
            "ArrowButton.size", Integer.valueOf(13),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
            "Button.defaultButtonFollowsFocus", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
            "Button.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
                         "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
                "released SPACE", "released",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
                         "ENTER", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
                "released ENTER", "released"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
              }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
            "Button.font", new FontLazyValue(Region.BUTTON),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            "Button.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            "CheckBox.focusInputMap", new UIDefaults.LazyInputMap(new Object[]{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                         "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
                "released SPACE", "released"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
              }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
            "CheckBox.icon", new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
                              "getCheckBoxIcon"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
            "CheckBox.font", new FontLazyValue(Region.CHECK_BOX),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
            "CheckBox.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
            "CheckBoxMenuItem.arrowIcon", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
            "CheckBoxMenuItem.checkIcon", new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
                              "getCheckBoxMenuItemCheckIcon"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
            "CheckBoxMenuItem.font",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
                new FontLazyValue(Region.CHECK_BOX_MENU_ITEM),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
            "CheckBoxMenuItem.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
            "CheckBoxMenuItem.alignAcceleratorText", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
            "ColorChooser.showPreviewPanelText", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
            "ColorChooser.panels", new UIDefaults.ActiveValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
                public Object createValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
                    return new AbstractColorChooserPanel[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
                                       new GTKColorChooserPanel() };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
            "ColorChooser.font", new FontLazyValue(Region.COLOR_CHOOSER),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
            "ComboBox.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
                     "ESCAPE", "hidePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
                    "PAGE_UP", "pageUpPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
                  "PAGE_DOWN", "pageDownPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
                       "HOME", "homePassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
                        "END", "endPassThrough",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
                       "DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
                    "KP_DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
                   "alt DOWN", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
                "alt KP_DOWN", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
                     "alt UP", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
                  "alt KP_UP", "togglePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
                      "SPACE", "spacePopup",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
                      "ENTER", "enterPressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
                         "UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
                      "KP_UP", "selectPrevious"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
            "ComboBox.font", new FontLazyValue(Region.COMBO_BOX),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
            "ComboBox.isEnterSelectablePopup", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
            "EditorPane.caretForeground", caretColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
            "EditorPane.caretAspectRatio", defaultCaretAspectRatio,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
            "EditorPane.caretBlinkRate", caretBlinkRate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
            "EditorPane.margin", editorMargin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
            "EditorPane.focusInputMap", multilineInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
            "EditorPane.font", new FontLazyValue(Region.EDITOR_PANE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
            "FileChooser.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
                     "ESCAPE", "cancelSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
                 "ctrl ENTER", "approveSelection"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
            "FileChooserUI", "com.sun.java.swing.plaf.gtk.GTKLookAndFeel",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
            "FormattedTextField.caretForeground", caretColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
            "FormattedTextField.caretAspectRatio", defaultCaretAspectRatio,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
            "FormattedTextField.caretBlinkRate", caretBlinkRate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
            "FormattedTextField.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
              new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
                           "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
                           "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
                           "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
                             "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
                            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
                              "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
                   "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
                     "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
                     "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
                       "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
                    "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
                      "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
                   "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
                        "ctrl LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
                     "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
                       "ctrl RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
                    "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
                  "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
               "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
                 "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
              "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
                           "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
                             "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
                              "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
                       "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
                        "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
                       "BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
                 "shift BACK_SPACE", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
                           "ctrl H", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
                           "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
                      "ctrl DELETE", DefaultEditorKit.deleteNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
                  "ctrl BACK_SPACE", DefaultEditorKit.deletePrevWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
                            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
                             "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
                         "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
                          "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
                            "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
                  "ctrl BACK_SLASH", "unselect",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
                  "control shift O", "toggle-componentOrientation",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
                           "ESCAPE", "reset-field-edit",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
                               "UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
                            "KP_UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
                             "DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
                          "KP_DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
              }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
            "FormattedTextField.font",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
                new FontLazyValue(Region.FORMATTED_TEXT_FIELD),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
            "InternalFrameTitlePane.titlePaneLayout",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
                                new GTKStyle.GTKLazyValue("com.sun.java.swing.plaf.gtk.Metacity",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
                                                 "getTitlePaneLayout"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
            "InternalFrame.windowBindings", new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
                  "shift ESCAPE", "showSystemMenu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
                    "ctrl SPACE", "showSystemMenu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
                        "ESCAPE", "hideSystemMenu" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
            "InternalFrame.layoutTitlePaneAtOrigin", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
            "InternalFrame.useTaskBar", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
            "InternalFrameTitlePane.iconifyButtonOpacity", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            "InternalFrameTitlePane.maximizeButtonOpacity", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
            "InternalFrameTitlePane.closeButtonOpacity", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
            "Label.font", new FontLazyValue(Region.LABEL),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
            "List.background", tableBg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
            "List.focusCellHighlightBorder", focusBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
            "List.focusSelectedCellHighlightBorder", focusSelectedBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
            "List.noFocusBorder", noFocusBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
            "List.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
                           "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
                           "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
                           "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
                             "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
                            "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                              "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
                   "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                     "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
                     "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
                               "UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
                            "KP_UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
                         "shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
                      "shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
                    "ctrl shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
                 "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
                          "ctrl UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
                       "ctrl KP_UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
                             "DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
                          "KP_DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
                       "shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
                    "shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
                  "ctrl shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
               "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
                        "ctrl DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
                     "ctrl KP_DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
                             "LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
                          "KP_LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
                       "shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                    "shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
                  "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
               "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
                        "ctrl LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
                     "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
                            "RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
                         "KP_RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
                      "shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
                   "shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
                 "ctrl shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
              "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
                       "ctrl RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
                    "ctrl KP_RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
                             "HOME", "selectFirstRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
                       "shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
                  "ctrl shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
                        "ctrl HOME", "selectFirstRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
                              "END", "selectLastRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
                        "shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
                   "ctrl shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
                         "ctrl END", "selectLastRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
                          "PAGE_UP", "scrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
                    "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
               "ctrl shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
                     "ctrl PAGE_UP", "scrollUpChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
                        "PAGE_DOWN", "scrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
                  "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
             "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
                   "ctrl PAGE_DOWN", "scrollDownChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
                           "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
                       "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
                  "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
                            "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
                       "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
                      "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
                 "ctrl shift SPACE", "moveSelectionTo"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
            "List.focusInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
                             "LEFT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
                          "KP_LEFT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
                       "shift LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
                    "shift KP_LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
                  "ctrl shift LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
               "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
                        "ctrl LEFT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
                     "ctrl KP_LEFT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
                            "RIGHT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
                         "KP_RIGHT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
                      "shift RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
                   "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
                 "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
              "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
                       "ctrl RIGHT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
                    "ctrl KP_RIGHT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
            "List.font", new FontLazyValue(Region.LIST),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
            "List.rendererUseUIBorder", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
            "Menu.arrowIcon", new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
                              "getMenuArrowIcon"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
            "Menu.checkIcon", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
            "Menu.font", new FontLazyValue(Region.MENU),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
            "Menu.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
            "Menu.cancelMode", "hideMenuTree",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
            "Menu.alignAcceleratorText", Boolean.FALSE,
13147
eada40c7d74d 7169111: Unreadable menu bar with Ambiance theme in GTK L&F
rupashka
parents: 5506
diff changeset
   767
            "Menu.useMenuBarForTopLevelMenus", Boolean.TRUE,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
13147
eada40c7d74d 7169111: Unreadable menu bar with Ambiance theme in GTK L&F
rupashka
parents: 5506
diff changeset
   770
                "MenuBar.windowBindings", new Object[] {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
                "F10", "takeFocus" },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
            "MenuBar.font", new FontLazyValue(Region.MENU_BAR),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
            "MenuItem.arrowIcon", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
            "MenuItem.checkIcon", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
            "MenuItem.font", new FontLazyValue(Region.MENU_ITEM),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
            "MenuItem.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
            "MenuItem.alignAcceleratorText", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
            "OptionPane.setButtonMargin", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
            "OptionPane.sameSizeButtons", Boolean.TRUE,
25777
bb88947b6766 8049893: Replace uses of 'new Integer()' with appropriate alternative across client classes
prr
parents: 24528
diff changeset
   784
            "OptionPane.buttonOrientation", SwingConstants.RIGHT,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
            "OptionPane.minimumSize", new DimensionUIResource(262, 90),
25777
bb88947b6766 8049893: Replace uses of 'new Integer()' with appropriate alternative across client classes
prr
parents: 24528
diff changeset
   786
            "OptionPane.buttonPadding", 10,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
            "OptionPane.windowBindings", new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
                "ESCAPE", "close" },
25777
bb88947b6766 8049893: Replace uses of 'new Integer()' with appropriate alternative across client classes
prr
parents: 24528
diff changeset
   789
            "OptionPane.buttonClickThreshhold", 500,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
            "OptionPane.isYesLast", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
            "OptionPane.font", new FontLazyValue(Region.OPTION_PANE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
            "Panel.font", new FontLazyValue(Region.PANEL),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
            "PasswordField.caretForeground", caretColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
            "PasswordField.caretAspectRatio", defaultCaretAspectRatio,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
            "PasswordField.caretBlinkRate", caretBlinkRate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
            "PasswordField.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
            "PasswordField.focusInputMap", passwordInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
            "PasswordField.font", new FontLazyValue(Region.PASSWORD_FIELD),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
            "PopupMenu.consumeEventOnClose", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
            "PopupMenu.selectedWindowInputMapBindings", new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
                  "ESCAPE", "cancel",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
                    "DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
                 "KP_DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
                      "UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
                   "KP_UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
                    "LEFT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
                 "KP_LEFT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
                   "RIGHT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
                "KP_RIGHT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
                   "ENTER", "return",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
                   "SPACE", "return"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
            "PopupMenu.selectedWindowInputMapBindings.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
                  new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
                    "LEFT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
                 "KP_LEFT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
                   "RIGHT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
                "KP_RIGHT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
            "PopupMenu.font", new FontLazyValue(Region.POPUP_MENU),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
            "ProgressBar.horizontalSize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
                new DimensionUIResource(hProgWidth, hProgHeight),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
            "ProgressBar.verticalSize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
                new DimensionUIResource(vProgWidth, vProgHeight),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
            "ProgressBar.font", new FontLazyValue(Region.PROGRESS_BAR),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
            "RadioButton.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
                   new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
                            "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
                   "released SPACE", "released",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
                           "RETURN", "pressed"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
                   }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
            "RadioButton.icon", new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
                              "getRadioButtonIcon"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
            "RadioButton.font", new FontLazyValue(Region.RADIO_BUTTON),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
            "RadioButton.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
            "RadioButtonMenuItem.arrowIcon", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
            "RadioButtonMenuItem.checkIcon", new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
                              "getRadioButtonMenuItemCheckIcon"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
            "RadioButtonMenuItem.font", new FontLazyValue(Region.RADIO_BUTTON_MENU_ITEM),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
            "RadioButtonMenuItem.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
            "RadioButtonMenuItem.alignAcceleratorText", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
            // These bindings are only enabled when there is a default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
            // button set on the rootpane.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
            "RootPane.defaultButtonWindowKeyBindings", new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
                               "ENTER", "press",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
                      "released ENTER", "release",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
                          "ctrl ENTER", "press",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
                 "ctrl released ENTER", "release"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
            "ScrollBar.squareButtons", Boolean.FALSE,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   865
            "ScrollBar.thumbHeight", Integer.valueOf(14),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   866
            "ScrollBar.width", Integer.valueOf(16),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
            "ScrollBar.minimumThumbSize", new Dimension(8, 8),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
            "ScrollBar.maximumThumbSize", new Dimension(4096, 4096),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
            "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
            "ScrollBar.alwaysShowThumb", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
            "ScrollBar.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
                   new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
                       "RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
                    "KP_RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
                        "DOWN", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
                     "KP_DOWN", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
                   "PAGE_DOWN", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
                        "LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
                     "KP_LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
                          "UP", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
                       "KP_UP", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
                     "PAGE_UP", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
                        "HOME", "minScroll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
                         "END", "maxScroll"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
                   }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
            "ScrollBar.ancestorInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
                       "RIGHT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
                    "KP_RIGHT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
                        "LEFT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
                     "KP_LEFT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
                    }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
            "Spinner.disableOnBoundaryValues", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
            "ScrollPane.fillUpperCorner", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
            "ScrollPane.fillLowerCorner", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
            "ScrollPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
                           "RIGHT", "unitScrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
                        "KP_RIGHT", "unitScrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
                            "DOWN", "unitScrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
                         "KP_DOWN", "unitScrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
                            "LEFT", "unitScrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
                         "KP_LEFT", "unitScrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
                              "UP", "unitScrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
                           "KP_UP", "unitScrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
                         "PAGE_UP", "scrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
                       "PAGE_DOWN", "scrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
                    "ctrl PAGE_UP", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
                  "ctrl PAGE_DOWN", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
                       "ctrl HOME", "scrollHome",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
                        "ctrl END", "scrollEnd"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
                    }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
            "ScrollPane.ancestorInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
                    "ctrl PAGE_UP", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
                  "ctrl PAGE_DOWN", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
                    }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
            "ScrollPane.font", new FontLazyValue(Region.SCROLL_PANE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
            "Separator.insets", zeroInsets,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   926
            "Separator.thickness", Integer.valueOf(2),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
            "Slider.paintValue", Boolean.TRUE,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   930
            "Slider.thumbWidth", Integer.valueOf(30),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   931
            "Slider.thumbHeight", Integer.valueOf(14),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
            "Slider.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
                            "RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
                         "KP_RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
                             "DOWN", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
                          "KP_DOWN", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
                        "PAGE_DOWN", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
                             "LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
                          "KP_LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
                               "UP", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
                            "KP_UP", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
                          "PAGE_UP", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
                             "HOME", "minScroll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
                              "END", "maxScroll"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
                        }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
            "Slider.focusInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
                            "RIGHT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
                         "KP_RIGHT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
                             "LEFT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
                          "KP_LEFT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
                         }),
456
8ded0dbe4aaa 6614972: JSlider value should not change on right-click
rupashka
parents: 2
diff changeset
   954
            "Slider.onlyLeftMouseButtonDrag", Boolean.FALSE,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
            "Spinner.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
                               "UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
                            "KP_UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
                             "DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
                          "KP_DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
               }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
            "Spinner.font", new FontLazyValue(Region.SPINNER),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
            "Spinner.editorAlignment", JTextField.LEADING,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
            "SplitPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
                        "UP", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
                      "DOWN", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
                      "LEFT", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
                     "RIGHT", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
                     "KP_UP", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
                   "KP_DOWN", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
                   "KP_LEFT", "negativeIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
                  "KP_RIGHT", "positiveIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
                      "HOME", "selectMin",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
                       "END", "selectMax",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
                        "F8", "startResize",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
                        "F6", "toggleFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
                  "ctrl TAB", "focusOutForward",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
            "ctrl shift TAB", "focusOutBackward"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
                    }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   985
            "SplitPane.size", Integer.valueOf(7),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   986
            "SplitPane.oneTouchOffset", Integer.valueOf(2),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   987
            "SplitPane.oneTouchButtonSize", Integer.valueOf(5),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
            "SplitPane.supportsOneTouchButtons", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
            "TabbedPane.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
              new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
                         "RIGHT", "navigateRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
                      "KP_RIGHT", "navigateRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
                          "LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
                       "KP_LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
                            "UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
                         "KP_UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
                          "DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
                       "KP_DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
                     "ctrl DOWN", "requestFocusForVisibleComponent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
                  "ctrl KP_DOWN", "requestFocusForVisibleComponent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
                         "SPACE", "selectTabWithFocus"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
                }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
            "TabbedPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
                         "ctrl TAB", "navigateNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
                   "ctrl shift TAB", "navigatePrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
                   "ctrl PAGE_DOWN", "navigatePageDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
                     "ctrl PAGE_UP", "navigatePageUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
                          "ctrl UP", "requestFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
                       "ctrl KP_UP", "requestFocus",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
            "TabbedPane.labelShift", 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
            "TabbedPane.selectedLabelShift", 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
            "TabbedPane.font", new FontLazyValue(Region.TABBED_PANE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
            "TabbedPane.selectedTabPadInsets", new InsetsUIResource(2, 2, 0, 1),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
            "Table.scrollPaneBorder", zeroBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
            "Table.background", tableBg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
            "Table.focusCellBackground", tableFocusCellBg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
            "Table.focusCellForeground", tableFocusCellFg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
            "Table.focusCellHighlightBorder", focusBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
            "Table.focusSelectedCellHighlightBorder", focusSelectedBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
            "Table.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
                               "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
                               "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
                               "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
                                 "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
                                "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
                                  "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
                       "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
                         "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
                         "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
                                "RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
                             "KP_RIGHT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
                          "shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
                       "shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
                     "ctrl shift RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
                  "ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
                           "ctrl RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
                        "ctrl KP_RIGHT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
                                 "LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
                              "KP_LEFT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
                           "shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
                        "shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
                      "ctrl shift LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
                   "ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
                            "ctrl LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
                         "ctrl KP_LEFT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
                                 "DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
                              "KP_DOWN", "selectNextRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
                           "shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
                        "shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
                      "ctrl shift DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
                   "ctrl shift KP_DOWN", "selectNextRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
                            "ctrl DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
                         "ctrl KP_DOWN", "selectNextRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
                                   "UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
                                "KP_UP", "selectPreviousRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
                             "shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
                          "shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
                        "ctrl shift UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
                     "ctrl shift KP_UP", "selectPreviousRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
                              "ctrl UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
                           "ctrl KP_UP", "selectPreviousRowChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
                                 "HOME", "selectFirstColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
                           "shift HOME", "selectFirstColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
                      "ctrl shift HOME", "selectFirstRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
                            "ctrl HOME", "selectFirstRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
                                  "END", "selectLastColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
                            "shift END", "selectLastColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
                       "ctrl shift END", "selectLastRowExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
                             "ctrl END", "selectLastRow",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
                              "PAGE_UP", "scrollUpChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
                        "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
                   "ctrl shift PAGE_UP", "scrollLeftExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
                         "ctrl PAGE_UP", "scrollLeftChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
                            "PAGE_DOWN", "scrollDownChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
                      "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
                 "ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
                       "ctrl PAGE_DOWN", "scrollRightChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
                                  "TAB", "selectNextColumnCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
                            "shift TAB", "selectPreviousColumnCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
                                "ENTER", "selectNextRowCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
                          "shift ENTER", "selectPreviousRowCell",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
                               "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
                           "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
                      "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
                               "ESCAPE", "cancel",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
                                   "F2", "startEditing",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
                                "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
                           "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
                          "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
                     "ctrl shift SPACE", "moveSelectionTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
                                   "F8", "focusHeader"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
                    }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
            "Table.ancestorInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
                                "RIGHT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
                             "KP_RIGHT", "selectPreviousColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
                          "shift RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
                       "shift KP_RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
                     "ctrl shift RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
                  "ctrl shift KP_RIGHT", "selectPreviousColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
                          "shift RIGHT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
                       "shift KP_RIGHT", "selectPreviousColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
                                 "LEFT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
                              "KP_LEFT", "selectNextColumn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
                           "shift LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
                        "shift KP_LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
                      "ctrl shift LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
                   "ctrl shift KP_LEFT", "selectNextColumnExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
                            "ctrl LEFT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
                         "ctrl KP_LEFT", "selectNextColumnChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
                         "ctrl PAGE_UP", "scrollRightChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
                       "ctrl PAGE_DOWN", "scrollLeftChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
                   "ctrl shift PAGE_UP", "scrollRightExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
                 "ctrl shift PAGE_DOWN", "scrollLeftExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
                    }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
            "Table.font", new FontLazyValue(Region.TABLE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
            "Table.ascendingSortIcon",  new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
                              "getAscendingSortIcon"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
            "Table.descendingSortIcon",  new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
                              "getDescendingSortIcon"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
            "TableHeader.font", new FontLazyValue(Region.TABLE_HEADER),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
            "TableHeader.alignSorterArrow", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
            "TextArea.caretForeground", caretColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
            "TextArea.caretAspectRatio", defaultCaretAspectRatio,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
            "TextArea.caretBlinkRate", caretBlinkRate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
            "TextArea.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
            "TextArea.focusInputMap", multilineInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
            "TextArea.font", new FontLazyValue(Region.TEXT_AREA),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
            "TextField.caretForeground", caretColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
            "TextField.caretAspectRatio", defaultCaretAspectRatio,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
            "TextField.caretBlinkRate", caretBlinkRate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
            "TextField.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
            "TextField.focusInputMap", fieldInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
            "TextField.font", new FontLazyValue(Region.TEXT_FIELD),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
            "TextPane.caretForeground", caretColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
            "TextPane.caretAspectRatio", defaultCaretAspectRatio,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
            "TextPane.caretBlinkRate", caretBlinkRate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
            "TextPane.margin", editorMargin,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
            "TextPane.focusInputMap", multilineInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
            "TextPane.font", new FontLazyValue(Region.TEXT_PANE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
            "TitledBorder.titleColor", controlText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
            "TitledBorder.border", new UIDefaults.LazyValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
                public Object createValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
                    return new GTKPainter.TitledBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
            "ToggleButton.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
                   new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
                            "SPACE", "pressed",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
                   "released SPACE", "released"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
                   }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
            "ToggleButton.font", new FontLazyValue(Region.TOGGLE_BUTTON),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
            "ToggleButton.margin", zeroInsets,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
            "ToolBar.separatorSize", new DimensionUIResource(10, 10),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
            "ToolBar.handleIcon", new UIDefaults.ActiveValue() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
                public Object createValue(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
                    return GTKIconFactory.getToolBarHandleIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
            },
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
            "ToolBar.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
               new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
                        "UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
                     "KP_UP", "navigateUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
                      "DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
                   "KP_DOWN", "navigateDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
                      "LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
                   "KP_LEFT", "navigateLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
                     "RIGHT", "navigateRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
                  "KP_RIGHT", "navigateRight"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
            "ToolBar.font", new FontLazyValue(Region.TOOL_BAR),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
            "ToolTip.font", new FontLazyValue(Region.TOOL_TIP),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1195
            "Tree.padding", Integer.valueOf(4),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
            "Tree.background", tableBg,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
            "Tree.drawHorizontalLines", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
            "Tree.drawVerticalLines", Boolean.FALSE,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1199
            "Tree.rowHeight", Integer.valueOf(-1),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
            "Tree.scrollsOnExpand", Boolean.FALSE,
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1201
            "Tree.expanderSize", Integer.valueOf(10),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
            "Tree.repaintWholeRow", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
            "Tree.closedIcon", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
            "Tree.leafIcon", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
            "Tree.openIcon", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
            "Tree.expandedIcon", new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
                              "getTreeExpandedIcon"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
            "Tree.collapsedIcon", new GTKStyle.GTKLazyValue(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
                              "com.sun.java.swing.plaf.gtk.GTKIconFactory",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
                              "getTreeCollapsedIcon"),
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1212
            "Tree.leftChildIndent", Integer.valueOf(2),
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
  1213
            "Tree.rightChildIndent", Integer.valueOf(12),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
            "Tree.scrollsHorizontallyAndVertically", Boolean.FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
            "Tree.drawsFocusBorder", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
            "Tree.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
                                 "ctrl C", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
                                 "ctrl V", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
                                 "ctrl X", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
                                   "COPY", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
                                  "PASTE", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
                                    "CUT", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
                         "control INSERT", "copy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
                           "shift INSERT", "paste",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
                           "shift DELETE", "cut",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
                                     "UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
                                  "KP_UP", "selectPrevious",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
                               "shift UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
                            "shift KP_UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
                          "ctrl shift UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
                       "ctrl shift KP_UP", "selectPreviousExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
                                "ctrl UP", "selectPreviousChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
                             "ctrl KP_UP", "selectPreviousChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
                                   "DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
                                "KP_DOWN", "selectNext",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
                             "shift DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
                          "shift KP_DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
                        "ctrl shift DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
                     "ctrl shift KP_DOWN", "selectNextExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
                              "ctrl DOWN", "selectNextChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
                           "ctrl KP_DOWN", "selectNextChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
                                  "RIGHT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
                               "KP_RIGHT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
                                   "LEFT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
                                "KP_LEFT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
                                "typed +", "expand",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
                                "typed -", "collapse",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
                             "BACK_SPACE", "moveSelectionToParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
                                "PAGE_UP", "scrollUpChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
                          "shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
                     "ctrl shift PAGE_UP", "scrollUpExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
                           "ctrl PAGE_UP", "scrollUpChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
                              "PAGE_DOWN", "scrollDownChangeSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
                        "shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
                   "ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
                         "ctrl PAGE_DOWN", "scrollDownChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
                                   "HOME", "selectFirst",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
                             "shift HOME", "selectFirstExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
                        "ctrl shift HOME", "selectFirstExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
                              "ctrl HOME", "selectFirstChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
                                    "END", "selectLast",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
                              "shift END", "selectLastExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
                         "ctrl shift END", "selectLastExtendSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
                               "ctrl END", "selectLastChangeLead",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
                                     "F2", "startEditing",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
                                 "ctrl A", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
                             "ctrl SLASH", "selectAll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
                        "ctrl BACK_SLASH", "clearSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
                              "ctrl LEFT", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
                           "ctrl KP_LEFT", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
                             "ctrl RIGHT", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
                          "ctrl KP_RIGHT", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
                                  "SPACE", "addToSelection",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
                             "ctrl SPACE", "toggleAndAnchor",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
                            "shift SPACE", "extendTo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
                       "ctrl shift SPACE", "moveSelectionTo"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
                    }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
            "Tree.focusInputMap.RightToLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
                    new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
                                  "RIGHT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
                               "KP_RIGHT", "selectParent",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
                                   "LEFT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
                                "KP_LEFT", "selectChild",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
                 }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
            "Tree.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
                      new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
                         "ESCAPE", "cancel"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
                      }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
            "Tree.font", new FontLazyValue(Region.TREE),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
            "Viewport.font", new FontLazyValue(Region.VIEWPORT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
        table.putDefaults(defaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
        if (fallbackFont != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
            table.put("TitledBorder.font", fallbackFont);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
        }
32485
e00f713e6103 6302464: Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
alexsch
parents: 30940
diff changeset
  1299
        if (aaTextInfo != null) {
e00f713e6103 6302464: Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
alexsch
parents: 30940
diff changeset
  1300
            table.putAll(aaTextInfo);
e00f713e6103 6302464: Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
alexsch
parents: 30940
diff changeset
  1301
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
    protected void initSystemColorDefaults(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
        GTKStyleFactory factory = (GTKStyleFactory)getStyleFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
        GTKStyle windowStyle =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
                (GTKStyle)factory.getStyle(null, Region.INTERNAL_FRAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
        table.put("window", windowStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
                GTKColorType.BACKGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
        table.put("windowText", windowStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
                GTKColorType.TEXT_FOREGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
        GTKStyle entryStyle = (GTKStyle)factory.getStyle(null, Region.TEXT_FIELD);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
        table.put("text", entryStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
                                           GTKColorType.TEXT_BACKGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
        table.put("textText", entryStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
                                           GTKColorType.TEXT_FOREGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
        table.put("textHighlight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
                entryStyle.getGTKColor(SynthConstants.SELECTED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
                                         GTKColorType.TEXT_BACKGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
        table.put("textHighlightText",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
                  entryStyle.getGTKColor(SynthConstants.SELECTED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
                                         GTKColorType.TEXT_FOREGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
        table.put("textInactiveText",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
                  entryStyle.getGTKColor(SynthConstants.DISABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
                                         GTKColorType.TEXT_FOREGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
        Object caretColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
            entryStyle.getClassSpecificValue("cursor-color");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
        if (caretColor == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
            caretColor = GTKStyle.BLACK_COLOR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
        table.put("caretColor", caretColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
        GTKStyle menuStyle = (GTKStyle)factory.getStyle(null, Region.MENU_ITEM);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
        table.put("menu", menuStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
                                           GTKColorType.BACKGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
        table.put("menuText", menuStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
                                           GTKColorType.TEXT_FOREGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
        GTKStyle scrollbarStyle = (GTKStyle)factory.getStyle(null, Region.SCROLL_BAR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
        table.put("scrollbar", scrollbarStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
                                           GTKColorType.BACKGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
        GTKStyle infoStyle = (GTKStyle)factory.getStyle(null, Region.OPTION_PANE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
        table.put("info", infoStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
                                           GTKColorType.BACKGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
        table.put("infoText", infoStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
                                           GTKColorType.TEXT_FOREGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
        GTKStyle desktopStyle = (GTKStyle)factory.getStyle(null, Region.DESKTOP_PANE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
        table.put("desktop", desktopStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
                                           GTKColorType.BACKGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
        // colors specific only for GTK
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
        // It is impossible to create a simple GtkWidget without specifying the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
        // type. So for GtkWidget we can use any appropriate concrete type of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
        // wigdet. LABEL in this case.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
        GTKStyle widgetStyle = (GTKStyle)factory.getStyle(null, Region.LABEL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
        Color bg = widgetStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
                                           GTKColorType.BACKGROUND);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
        table.put("control", bg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
        table.put("controlHighlight", bg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
        table.put("controlText", widgetStyle.getGTKColor(SynthConstants.ENABLED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
                                               GTKColorType.TEXT_FOREGROUND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
        table.put("controlLtHighlight", widgetStyle.getGTKColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
                SynthConstants.ENABLED, GTKColorType.LIGHT));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
        table.put("controlShadow", widgetStyle.getGTKColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
                SynthConstants.ENABLED, GTKColorType.DARK));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
        table.put("controlDkShadow", widgetStyle.getGTKColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
                SynthConstants.ENABLED, GTKColorType.BLACK));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
        table.put("light", widgetStyle.getGTKColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
                SynthConstants.ENABLED, GTKColorType.LIGHT));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
        table.put("mid", widgetStyle.getGTKColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
                SynthConstants.ENABLED, GTKColorType.MID));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
        table.put("dark", widgetStyle.getGTKColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
                SynthConstants.ENABLED, GTKColorType.DARK));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
        table.put("black", widgetStyle.getGTKColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
                SynthConstants.ENABLED, GTKColorType.BLACK));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
        table.put("white", widgetStyle.getGTKColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
                SynthConstants.ENABLED, GTKColorType.WHITE));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
     * Creates the GTK look and feel class for the passed in Component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
    public static ComponentUI createUI(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
        String key = c.getUIClassID().intern();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
        if (key == "FileChooserUI") {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
            return GTKFileChooserUI.createUI(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
        return SynthLookAndFeel.createUI(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
     * Returns the cached gtkThemeName
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
    static String getGtkThemeName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
        return gtkThemeName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
    static boolean isLeftToRight(Component c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
        return c.getComponentOrientation().isLeftToRight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
    public void initialize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
         * We need to call loadGTK() to ensure that the native GTK
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
         * libraries are loaded.  It is very unlikely that this call will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
         * fail (since we've already verified native GTK support in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
         * isSupportedLookAndFeel()), but we can throw an error in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
         * failure situation just in case.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
        Toolkit toolkit = Toolkit.getDefaultToolkit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1415
        if (toolkit instanceof UNIXToolkit &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
            !((UNIXToolkit)toolkit).loadGTK())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
            throw new InternalError("Unable to load native GTK libraries");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
37711
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1421
        if (UNIXToolkit.getGtkVersion() == UNIXToolkit.GtkVersions.GTK2) {
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1422
            String version = AccessController.doPrivileged(
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1423
                    new GetPropertyAction("jdk.gtk.version"));
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1424
            if (version != null) {
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1425
                IS_22 = version.equals("2.2");
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1426
            } else {
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1427
                IS_22 = true;
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1428
            }
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1429
        } else if (UNIXToolkit.getGtkVersion() ==
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1430
                                UNIXToolkit.GtkVersions.GTK3) {
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1431
            IS_3 = true;
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1432
        }
972001566d66 8145547: [AWT/Swing] Conditional support for GTK 3 on Linux
ssadetsky
parents: 32485
diff changeset
  1433
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
        super.initialize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
        inInitialize = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
        loadStyles();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
        inInitialize = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
         * Check if system AA font settings should be used.
40140
ddb766940954 8162429: Clean up obsolete font preferences for JDS.
prr
parents: 37714
diff changeset
  1441
         * REMIND: See comment on isLocalDisplay() definition regarding
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
         * XRender.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
         */
40140
ddb766940954 8162429: Clean up obsolete font preferences for JDS.
prr
parents: 37714
diff changeset
  1444
        gtkAAFontSettingsCond = SwingUtilities2.isLocalDisplay();
32485
e00f713e6103 6302464: Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
alexsch
parents: 30940
diff changeset
  1445
        aaTextInfo = new HashMap<>(2);
e00f713e6103 6302464: Allow programmatic enabling of subpixel anti-aliasing in Swing on ANY platform
alexsch
parents: 30940
diff changeset
  1446
        SwingUtilities2.putAATextInfo(gtkAAFontSettingsCond, aaTextInfo);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
1843
267cc4de4221 6776095: Code improvement and warnings removing from swing packages
rupashka
parents: 715
diff changeset
  1449
    static ReferenceQueue<GTKLookAndFeel> queue = new ReferenceQueue<GTKLookAndFeel>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
    private static void flushUnreferenced() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
        WeakPCL pcl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
        while ((pcl = (WeakPCL)queue.poll()) != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
            pcl.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
1843
267cc4de4221 6776095: Code improvement and warnings removing from swing packages
rupashka
parents: 715
diff changeset
  1459
    static class WeakPCL extends WeakReference<GTKLookAndFeel> implements
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
            PropertyChangeListener {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
        private Toolkit kit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
        private String key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
1843
267cc4de4221 6776095: Code improvement and warnings removing from swing packages
rupashka
parents: 715
diff changeset
  1464
        WeakPCL(GTKLookAndFeel target, Toolkit kit, String key) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
            super(target, queue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
            this.kit = kit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
            this.key = key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
        public String getKey() { return key; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
        public void propertyChange(final PropertyChangeEvent pce) {
1843
267cc4de4221 6776095: Code improvement and warnings removing from swing packages
rupashka
parents: 715
diff changeset
  1473
            final GTKLookAndFeel lnf = get();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1474
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1475
            if (lnf == null || UIManager.getLookAndFeel() != lnf) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
                // The property was GC'ed, we're no longer interested in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
                // PropertyChanges, remove the listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
                dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1480
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1481
                // We are using invokeLater here because we are getting called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
                // on the AWT-Motif thread which can cause a deadlock.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
                SwingUtilities.invokeLater(new Runnable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
                    public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
                        String name = pce.getPropertyName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
                        /* We are listening for GTK desktop text AA settings:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
                         * "gnome.Xft/Antialias" and "gnome.Xft/RGBA".
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
                         * However we don't need to read these here as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
                         * the UIDefaults reads them and this event causes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
                         * those to be reinitialised.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
                         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
                        if ("gnome.Net/ThemeName".equals(name)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
                            GTKEngine.INSTANCE.themeChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1494
                            GTKIconFactory.resetIcons();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1495
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
                        lnf.loadStyles();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
                        Window appWindows[] = Window.getWindows();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
                        for (int i = 0; i < appWindows.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
                            SynthLookAndFeel.updateStyles(appWindows[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1502
                });
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1503
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1504
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1505
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1506
        void dispose() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
            kit.removePropertyChangeListener(key, this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
    public boolean isSupportedLookAndFeel() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1512
        Toolkit toolkit = Toolkit.getDefaultToolkit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1513
        return (toolkit instanceof SunToolkit &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
                ((SunToolkit)toolkit).isNativeGTKAvailable());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
    public boolean isNativeLookAndFeel() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
    public String getDescription() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
        return "GTK look and feel";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
    public String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
        return "GTK look and feel";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
    public String getID() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
        return "GTK";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1531
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
    // Subclassed to pass in false to the superclass, we don't want to try
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
    // and load the system colors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
    protected void loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
        super.loadSystemColors(table, systemColors, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1539
    private void loadStyles() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1540
        gtkThemeName = (String)Toolkit.getDefaultToolkit().
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
                getDesktopProperty("gnome.Net/ThemeName");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
        setStyleFactory(getGTKStyleFactory());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
        // If we are in initialize initializations will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
        // called later, don't do it now.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
        if (!inInitialize) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1548
            UIDefaults table = UIManager.getLookAndFeelDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1549
            initSystemColorDefaults(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
            initComponentDefaults(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
    private GTKStyleFactory getGTKStyleFactory() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
        GTKEngine engine = GTKEngine.INSTANCE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1557
        Object iconSizes = engine.getSetting(GTKEngine.Settings.GTK_ICON_SIZES);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1558
        if (iconSizes instanceof String) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
            if (!configIconSizes((String)iconSizes)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
                System.err.println("Error parsing gtk-icon-sizes string: '" + iconSizes + "'");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1562
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1563
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
        // Desktop property appears to have preference over rc font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
        Object fontName = Toolkit.getDefaultToolkit().getDesktopProperty(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
                                  "gnome.Gtk/FontName");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1567
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1568
       if (!(fontName instanceof String)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
            fontName = engine.getSetting(GTKEngine.Settings.GTK_FONT_NAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
            if (!(fontName instanceof String)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
               fontName = "sans 10";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1572
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1573
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
        if (styleFactory == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
            styleFactory = new GTKStyleFactory();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1577
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1578
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
        Font defaultFont = PangoFonts.lookupFont((String)fontName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
        fallbackFont = defaultFont;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
        styleFactory.initStyles(defaultFont);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1582
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1583
        return styleFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
    private boolean configIconSizes(String sizeString) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1587
        String[] sizes = sizeString.split(":");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1588
        for (int i = 0; i < sizes.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
            String[] splits = sizes[i].split("=");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
            if (splits.length != 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1592
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1593
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
            String size = splits[0].trim().intern();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
            if (size.length() < 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1597
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1598
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
            splits = splits[1].split(",");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
            if (splits.length != 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1606
            String width = splits[0].trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1607
            String height = splits[1].trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
            if (width.length() < 1 || height.length() < 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1611
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1612
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1613
            int w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1614
            int h;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1615
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1616
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1617
                w = Integer.parseInt(width);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1618
                h = Integer.parseInt(height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
            } catch (NumberFormatException nfe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1621
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1622
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
            if (w > 0 && h > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
                int type = GTKStyle.GTKStockIconInfo.getIconType(size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
                GTKStyle.GTKStockIconInfo.setIconSize(type, w, h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1626
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1627
                System.err.println("Invalid size in gtk-icon-sizes: " + w + "," + h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1631
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1632
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
     * Returns whether or not the UIs should update their
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1636
     * <code>SynthStyles</code> from the <code>SynthStyleFactory</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1637
     * when the ancestor of the Component changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
     * @return whether or not the UIs should update their
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
     * <code>SynthStyles</code> from the <code>SynthStyleFactory</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1641
     * when the ancestor changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1642
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
    public boolean shouldUpdateStyleOnAncestorChanged() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1646
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1647
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
     * {@inheritDoc}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1650
    public LayoutStyle getLayoutStyle() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1651
        return GnomeLayoutStyle.INSTANCE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1652
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1653
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
     * Gnome layout style.  From:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1657
     * http://developer.gnome.org/projects/gup/hig/2.0/design-window.html#window-layout-spacing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1658
     * You'll notice this doesn't do the radiobutton/checkbox border
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1659
     * adjustments that windows/metal do.  This is because gtk doesn't
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1660
     * provide margins/insets for checkbox/radiobuttons.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1661
     */
24528
21c5bb3d76cc 8039860: Fix fallthrough lint warnings in swing
darcy
parents: 23632
diff changeset
  1662
    @SuppressWarnings("fallthrough")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
    private static class GnomeLayoutStyle extends DefaultLayoutStyle {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1664
        private static GnomeLayoutStyle INSTANCE = new GnomeLayoutStyle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1665
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1666
        @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
        public int getPreferredGap(JComponent component1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
                JComponent component2, ComponentPlacement type, int position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1669
                Container parent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1670
            // Checks args
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
            super.getPreferredGap(component1, component2, type, position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
                                  parent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1674
            switch(type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1675
            case INDENT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1676
                if (position == SwingConstants.EAST ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
                        position == SwingConstants.WEST) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
                    // Indent group members 12 pixels to denote hierarchy and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
                    // association.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1680
                    return 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1681
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1682
                // Fall through to related
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1683
            // As a basic rule of thumb, leave space between user
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1684
            // interface components in increments of 6 pixels, going up as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1685
            // the relationship between related elements becomes more
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
            // distant. For example, between icon labels and associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1687
            // graphics within an icon, 6 pixels are adequate. Between
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1688
            // labels and associated components, leave 12 horizontal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1689
            // pixels. For vertical spacing between groups of components,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
            // 18 pixels is adequate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1692
            // The first part of this is handled automatically by Icon (which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1693
            // won't give you 6 pixels).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
            case RELATED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
                if (isLabelAndNonlabel(component1, component2, position)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
                    return 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1697
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1698
                return 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1699
            case UNRELATED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1700
                return 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1701
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1702
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1703
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1704
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1705
        @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1706
        public int getContainerGap(JComponent component, int position,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1707
                                   Container parent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1708
            // Checks args
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1709
            super.getContainerGap(component, position, parent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1710
            // A general padding of 12 pixels is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1711
            // recommended between the contents of a dialog window and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1712
            // window borders.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1713
            return 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1714
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1715
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
}