jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java
author yan
Mon, 30 Jun 2014 16:32:36 +0400
changeset 25178 dbab904451e9
parent 22574 7f8ce0c8c20a
permissions -rw-r--r--
8046434: Fix doclint warnings from javax.swing.plaf.metal package Reviewed-by: alexsch Contributed-by: Andrei Eremeev <andrei.eremeev@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
     2
 * Copyright (c) 1998, 2014, 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 javax.swing.plaf.metal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import sun.swing.SwingUtilities2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.swing.BorderFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.swing.border.Border;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.swing.plaf.basic.BasicToolTipUI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.swing.plaf.basic.BasicHTML;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.swing.text.View;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
/**
20169
d7fa6d7586c9 8025085: [javadoc] some errors in javax/swing
yan
parents: 5506
diff changeset
    41
 * A Metal L&amp;F extension of BasicToolTipUI.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * the same version of Swing.  As of 1.4, support for long term storage
20458
f2423fb3fd19 8025840: Fix all the doclint warnings about trademark
cl
parents: 20169
diff changeset
    48
 * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @author Steve Wilson
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
    54
@SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
public class MetalToolTipUI extends BasicToolTipUI {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    static MetalToolTipUI sharedInstance = new MetalToolTipUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private Font smallFont;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    // Refer to note in getAcceleratorString about this field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    private JToolTip tip;
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    61
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    62
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    63
     * The space between strings.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    64
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    public static final int padSpaceBetweenStrings = 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    private String acceleratorDelimiter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    68
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    69
     * Constructs an instance of the {@code MetalToolTipUI}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    70
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public MetalToolTipUI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    75
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    76
     * Returns an instance of the {@code MetalToolTipUI}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    77
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    78
     * @param c a component
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    79
     * @return an instance of the {@code MetalToolTipUI}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
    80
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public static ComponentUI createUI(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        return sharedInstance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public void installUI(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        super.installUI(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        tip = (JToolTip)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        Font f = c.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        smallFont = new Font( f.getName(), f.getStyle(), f.getSize() - 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        acceleratorDelimiter = UIManager.getString( "MenuItem.acceleratorDelimiter" );
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        if ( acceleratorDelimiter == null ) { acceleratorDelimiter = "-"; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public void uninstallUI(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        super.uninstallUI(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        tip = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public void paint(Graphics g, JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        JToolTip tip = (JToolTip)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        Font font = c.getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        FontMetrics metrics = SwingUtilities2.getFontMetrics(c, g, font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        Dimension size = c.getSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        int accelBL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        g.setColor(c.getForeground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        // fix for bug 4153892
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        String tipText = tip.getTipText();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        if (tipText == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            tipText = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        String accelString = getAcceleratorString(tip);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        FontMetrics accelMetrics = SwingUtilities2.getFontMetrics(c, g, smallFont);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        int accelSpacing = calcAccelSpacing(c, accelMetrics, accelString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        Insets insets = tip.getInsets();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        Rectangle paintTextR = new Rectangle(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            insets.left + 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            insets.top,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
            size.width - (insets.left + insets.right) - 6 - accelSpacing,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            size.height - (insets.top + insets.bottom));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        View v = (View) c.getClientProperty(BasicHTML.propertyKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        if (v != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            v.paint(g, paintTextR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            accelBL = BasicHTML.getHTMLBaseline(v, paintTextR.width,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                                                  paintTextR.height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            g.setFont(font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            SwingUtilities2.drawString(tip, g, tipText, paintTextR.x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                                  paintTextR.y + metrics.getAscent());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            accelBL = metrics.getAscent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        if (!accelString.equals("")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            g.setFont(smallFont);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            g.setColor( MetalLookAndFeel.getPrimaryControlDarkShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            SwingUtilities2.drawString(tip, g, accelString,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                                       tip.getWidth() - 1 - insets.right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                                           - accelSpacing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                                           + padSpaceBetweenStrings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                                           - 3,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                                       paintTextR.y + accelBL);
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
    private int calcAccelSpacing(JComponent c, FontMetrics fm, String accel) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        return accel.equals("")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
               ? 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
               : padSpaceBetweenStrings +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                 SwingUtilities2.stringWidth(c, fm, accel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    public Dimension getPreferredSize(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        Dimension d = super.getPreferredSize(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        String key = getAcceleratorString((JToolTip)c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        if (!(key.equals(""))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            d.width += calcAccelSpacing(c, c.getFontMetrics(smallFont), key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        return d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   164
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   165
     * If the accelerator is hidden, the method returns {@code true},
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   166
     * otherwise, returns {@code false}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   167
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   168
     * @return {@code true} if the accelerator is hidden.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   169
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    protected boolean isAcceleratorHidden() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        Boolean b = (Boolean)UIManager.get("ToolTip.hideAccelerator");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        return b != null && b.booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    private String getAcceleratorString(JToolTip tip) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        this.tip = tip;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        String retValue = getAcceleratorString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        this.tip = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        return retValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   184
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   185
     * Returns the accelerator string.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   186
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   187
     * @return the accelerator string.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 22574
diff changeset
   188
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    // NOTE: This requires the tip field to be set before this is invoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    // As MetalToolTipUI is shared between all JToolTips the tip field is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    // set appropriately before this is invoked. Unfortunately this means
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    // that subclasses that randomly invoke this method will see varying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    // results. If this becomes an issue, MetalToolTipUI should no longer be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    // shared.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    public String getAcceleratorString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        if (tip == null || isAcceleratorHidden()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            return "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        JComponent comp = tip.getComponent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        if (!(comp instanceof AbstractButton)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            return "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        KeyStroke[] keys = comp.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).keys();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        if (keys == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            return "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        String controlKeyStr = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        for (int i = 0; i < keys.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            int mod = keys[i].getModifiers();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            controlKeyStr = KeyEvent.getKeyModifiersText(mod) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                            acceleratorDelimiter +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                            KeyEvent.getKeyText(keys[i].getKeyCode());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        return controlKeyStr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
}