jdk/src/solaris/classes/sun/awt/X11/XAWTLookAndFeel.java
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 5506 202f599c92aa
child 23647 41d22f2dbeb5
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
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: 2
diff changeset
     2
 * Copyright (c) 2003, 2007, 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: 2
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: 2
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: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
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 sun.awt.X11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.Font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.SystemColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.swing.border.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.swing.text.DefaultEditorKit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.swing.plaf.basic.BasicBorders;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import com.sun.java.swing.plaf.motif.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import sun.awt.X11.XComponentPeer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
class XAWTLookAndFeel extends MotifLookAndFeel {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     * Load the SystemColors into the defaults table.  The keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * for SystemColor defaults are the same as the names of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     * the public fields in SystemColor.  If the table is being
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * created on a native Motif platform we use the SystemColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * values, otherwise we create color objects whose values match
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * the default CDE/Motif colors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    protected void initSystemColorDefaults(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        String[] defaultSystemColors = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
            "desktop", "#005C5C", /* Color of the desktop background */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
            "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
            "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
            "activeCaptionBorder", "#B24D7A", /* Border color for caption (title bar) window borders. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
            "inactiveCaption", "#AEB2C3", /* Color for captions (title bars) when not active. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
            "inactiveCaptionText", "#000000", /* Text color for text in inactive captions (title bars). */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
            "inactiveCaptionBorder", "#AEB2C3", /* Border color for inactive caption (title bar) window borders. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
            "window", "#AEB2C3", /* Default color for the interior of windows */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
            "windowBorder", "#AEB2C3", /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
            "windowText", "#000000", /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
            "menu", "#AEB2C3", /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
            "menuText", "#000000", /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
            "text", "#FFF7E9", /* Text background color */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
            "textText", "#000000", /* Text foreground color */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
            "textHighlight", "#000000", /* Text background color when selected */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            "textHighlightText", "#FFF7E9", /* Text color when selected */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
            "textInactiveText", "#808080", /* Text color when disabled */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
            "control", "#AEB2C3", /* Default color for controls (buttons, sliders, etc) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
            "controlText", "#000000", /* Default color for text in controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
            "controlHighlight", "#DCDEE5", /* Highlight color for controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            "controlLtHighlight", "#DCDEE5", /* Light highlight color for controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
            "controlShadow", "#63656F", /* Shadow color for controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
            "controlLightShadow", "#9397A5", /* Shadow color for controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            "controlDkShadow", "#000000", /* Dark shadow color for controls */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
            "scrollbar", "#AEB2C3", /* Scrollbar ??? color. PENDING(jeff) foreground? background? ?*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
            "info", "#FFF7E9", /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            "infoText", "#000000"  /* ??? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        loadSystemColors(table, defaultSystemColors, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    protected void initComponentDefaults(UIDefaults table) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        super.initComponentDefaults(table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        FontUIResource dialogPlain12 = new FontUIResource(Font.DIALOG,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                                                          Font.PLAIN, 12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        FontUIResource sansSerifPlain12 = new FontUIResource(Font.SANS_SERIF,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                                                             Font.PLAIN, 12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        FontUIResource monospacedPlain12 = new FontUIResource(Font.MONOSPACED,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                                                              Font.PLAIN, 12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        ColorUIResource red = new ColorUIResource(Color.red);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        ColorUIResource black = new ColorUIResource(Color.black);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        ColorUIResource white = new ColorUIResource(Color.white);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        ColorUIResource lightGray = new ColorUIResource(Color.lightGray);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        ColorUIResource controlDarker =  new ColorUIResource(SystemColor.controlDkShadow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        Color back = table.getColor("control");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        Color colors [] = XComponentPeer.getSystemColors();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        Color scrollBarBackground = colors[XComponentPeer.BACKGROUND_COLOR];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        Color trackColor = new Color(MotifColorUtilities.calculateSelectFromBackground(scrollBarBackground.getRed(), scrollBarBackground.getGreen(), scrollBarBackground.getBlue()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        Border loweredBevelBorder = new MotifBorders.BevelBorder(false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                                                                 table.getColor("controlShadow"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                                                                 table.getColor("controlLtHighlight"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        Border raisedBevelBorder = new MotifBorders.BevelBorder(true,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                                                                table.getColor("controlShadow"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                                                                table.getColor("controlLtHighlight"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        Border marginBorder = new BasicBorders.MarginBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        Border focusBorder = new MotifBorders.FocusBorder(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
            table.getColor("control"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            table.getColor("activeCaptionBorder"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        Border focusBevelBorder = new BorderUIResource.CompoundBorderUIResource(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            focusBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            loweredBevelBorder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        Border textFieldBorder = new BorderUIResource.CompoundBorderUIResource(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            focusBevelBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            marginBorder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        // *** Text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            "control C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            "control V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            "control X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            "control F", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            "control B", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            "control D", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            "typed \010", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            "control LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            "control RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            "control SLASH", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            "control BACK_SLASH", "unselect",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            "control shift O", "toggle-componentOrientation"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        Object passwordInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            "control C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            "control V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            "control X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            "control F", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            "control B", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            "control D", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            "typed \010", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            "control LEFT", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            "control RIGHT", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            "control shift LEFT", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            "control shift RIGHT", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            "control SLASH", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            "control BACK_SLASH", "unselect",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            "control shift O", "toggle-componentOrientation"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        Object multilineInputMap = new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            "control C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            "control V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            "control X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            "control INSERT", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            "shift INSERT", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            "shift DELETE", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            "control F", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            "control B", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            "control D", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            "typed \010", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            "control LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            "control RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            "control shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            "control shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            "control SLASH", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            "control N", DefaultEditorKit.downAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            "control P", DefaultEditorKit.upAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            "UP", DefaultEditorKit.upAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            "DOWN", DefaultEditorKit.downAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            "KP_UP", DefaultEditorKit.upAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            "KP_DOWN", DefaultEditorKit.downAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            "PAGE_UP", DefaultEditorKit.pageUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            "PAGE_DOWN", DefaultEditorKit.pageDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            "shift PAGE_UP", "selection-page-up",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            "shift PAGE_DOWN", "selection-page-down",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            "ctrl shift PAGE_UP", "selection-page-left",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            "ctrl shift PAGE_DOWN", "selection-page-right",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            "shift UP", DefaultEditorKit.selectionUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
            "shift DOWN", DefaultEditorKit.selectionDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            "shift KP_UP", DefaultEditorKit.selectionUpAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            "shift KP_DOWN", DefaultEditorKit.selectionDownAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            "ENTER", DefaultEditorKit.insertBreakAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
            "TAB", DefaultEditorKit.insertTabAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            "control BACK_SLASH", "unselect",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
            "control HOME", DefaultEditorKit.beginAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            "control END", DefaultEditorKit.endAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
            "control shift HOME", DefaultEditorKit.selectionBeginAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            "control shift END", DefaultEditorKit.selectionEndAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            "control T", "next-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            "control shift T", "previous-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
            "control SPACE", "activate-link-action",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            "control shift O", "toggle-componentOrientation"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        Object sliderFocusInsets = new InsetsUIResource( 0, 0, 0, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        Object[] defaults = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            "ScrollBar.background", scrollBarBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            "ScrollBar.foreground", table.get("control"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            "ScrollBar.track", trackColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            "ScrollBar.trackHighlight", trackColor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
            "ScrollBar.thumb", scrollBarBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
            "ScrollBar.thumbHighlight", table.get("controlHighlight") ,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            "ScrollBar.thumbDarkShadow", table.get("controlDkShadow"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
            "ScrollBar.thumbShadow", table.get("controlShadow"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            "ScrollBar.border", loweredBevelBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
            "ScrollBar.allowsAbsolutePositioning", Boolean.TRUE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            "ScrollBar.defaultWidth", Integer.valueOf(17),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            "ScrollBar.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                "RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
                "KP_RIGHT", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
                "DOWN", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
                "KP_DOWN", "positiveUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                "PAGE_DOWN", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                "ctrl PAGE_DOWN", "positiveBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                "LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
                "KP_LEFT", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                "UP", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                "KP_UP", "negativeUnitIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                "PAGE_UP", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                "ctrl PAGE_UP", "negativeBlockIncrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                "HOME", "minScroll",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                "END", "maxScroll"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            "ScrollPane.font", dialogPlain12,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            "ScrollPane.background", scrollBarBackground,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
            "ScrollPane.foreground", table.get("controlText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            "ScrollPane.border", null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            "ScrollPane.viewportBorder", loweredBevelBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            "ScrollPane.ancestorInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                "RIGHT", "unitScrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                "KP_RIGHT", "unitScrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                "DOWN", "unitScrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                "KP_DOWN", "unitScrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                "LEFT", "unitScrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                "KP_LEFT", "unitScrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                "UP", "unitScrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                "KP_UP", "unitScrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                "PAGE_UP", "scrollUp",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                "PAGE_DOWN", "scrollDown",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                "ctrl PAGE_UP", "scrollLeft",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                "ctrl PAGE_DOWN", "scrollRight",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                "ctrl HOME", "scrollHome",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                "ctrl END", "scrollEnd"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            "FormattedTextField.focusInputMap",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            new UIDefaults.LazyInputMap(new Object[] {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                "ctrl C", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                "ctrl V", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                "ctrl X", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                "COPY", DefaultEditorKit.copyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                "PASTE", DefaultEditorKit.pasteAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                "CUT", DefaultEditorKit.cutAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                "shift LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                "shift RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                "ctrl LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                "ctrl KP_LEFT", DefaultEditorKit.previousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                "ctrl RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                "ctrl KP_RIGHT", DefaultEditorKit.nextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
                "ctrl shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                "ctrl shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                "ctrl shift RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                "ctrl shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                "ctrl A", DefaultEditorKit.selectAllAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
                "HOME", DefaultEditorKit.beginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                "END", DefaultEditorKit.endLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                "shift HOME", DefaultEditorKit.selectionBeginLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
                "shift END", DefaultEditorKit.selectionEndLineAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
                "typed \010", DefaultEditorKit.deletePrevCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
                "DELETE", DefaultEditorKit.deleteNextCharAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
                "RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                "LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                "KP_RIGHT", DefaultEditorKit.forwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                "KP_LEFT", DefaultEditorKit.backwardAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
                "ENTER", JTextField.notifyAction,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                "ctrl BACK_SLASH", "unselect",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                "control shift O", "toggle-componentOrientation",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
                "ESCAPE", "reset-field-edit",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                "UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                "KP_UP", "increment",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                "DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                "KP_DOWN", "decrement",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            }),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
            "TextField.caretForeground", black,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
            "TextField.caretBlinkRate", Integer.valueOf(500),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            "TextField.inactiveForeground", table.get("textInactiveText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
            "TextField.selectionBackground", table.get("textHighlight"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
            "TextField.selectionForeground", table.get("textHighlightText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            "TextField.background", table.get("window"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
            "TextField.foreground", table.get("textText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            "TextField.font", sansSerifPlain12,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            "TextField.border", textFieldBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            "TextField.focusInputMap", fieldInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            "PasswordField.caretForeground", black,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
            "PasswordField.caretBlinkRate", Integer.valueOf(500),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
            "PasswordField.inactiveForeground", table.get("textInactiveText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            "PasswordField.selectionBackground", table.get("textHighlight"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            "PasswordField.selectionForeground", table.get("textHighlightText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            "PasswordField.background", table.get("window"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            "PasswordField.foreground", table.get("textText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
            "PasswordField.font", sansSerifPlain12,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
            "PasswordField.border", textFieldBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
            "PasswordField.focusInputMap", passwordInputMap,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            "TextArea.caretForeground", black,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            "TextArea.caretBlinkRate", Integer.valueOf(500),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
            "TextArea.inactiveForeground", table.get("textInactiveText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            "TextArea.selectionBackground", table.get("textHighlight"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            "TextArea.selectionForeground", table.get("textHighlightText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            "TextArea.background", table.get("window"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
            "TextArea.foreground", table.get("textText"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
            "TextArea.font", monospacedPlain12,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
            "TextArea.border", marginBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            "TextArea.focusInputMap", multilineInputMap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        table.putDefaults(defaults);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
}