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