jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 1295 3cf2264a5743
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2002-2006 Sun Microsystems, Inc.  All Rights Reserved.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.swing.plaf.synth;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.beans.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.swing.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.swing.plaf.basic.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import javax.swing.border.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.util.Arrays;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.util.ArrayList;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import sun.swing.plaf.synth.SynthUI;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * Synth's MenuUI.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * @author Georges Saab
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @author David Karlton
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @author Arnaud Weber
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
                               SynthUI {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    private SynthStyle style;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    private SynthStyle accStyle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    private String acceleratorDelimiter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    public static ComponentUI createUI(JComponent x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        return new SynthMenuUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    protected void installDefaults() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        updateStyle(menuItem);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    protected void installListeners() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        super.installListeners();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        menuItem.addPropertyChangeListener(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private void updateStyle(JMenuItem mi) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        SynthStyle oldStyle = style;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        SynthContext context = getContext(mi, ENABLED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        style = SynthLookAndFeel.updateStyle(context, this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        if (oldStyle != style) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
            String prefix = getPropertyPrefix();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
            defaultTextIconGap = style.getInt(
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                           context, prefix + ".textIconGap", 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            if (menuItem.getMargin() == null ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                         (menuItem.getMargin() instanceof UIResource)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                Insets insets = (Insets)style.get(context, prefix + ".margin");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                if (insets == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                    // Some places assume margins are non-null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                    insets = SynthLookAndFeel.EMPTY_UIRESOURCE_INSETS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                menuItem.setMargin(insets);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            acceleratorDelimiter = style.getString(context, prefix +
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                                            ".acceleratorDelimiter", "+");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            if (useCheckAndArrow()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                checkIcon = style.getIcon(context, prefix + ".checkIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                arrowIcon = style.getIcon(context, prefix + ".arrowIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                // Not needed in this case
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                checkIcon = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                arrowIcon = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
            ((JMenu)menuItem).setDelay(style.getInt(context, prefix +
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                                                    ".delay", 200));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
            if (oldStyle != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                uninstallKeyboardActions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                installKeyboardActions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        context.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        SynthContext accContext = getContext(mi, Region.MENU_ITEM_ACCELERATOR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                                             ENABLED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        accStyle = SynthLookAndFeel.updateStyle(accContext, this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        accContext.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    protected void uninstallDefaults() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        SynthContext context = getContext(menuItem, ENABLED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        style.uninstallDefaults(context);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        context.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        style = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        SynthContext accContext = getContext(menuItem,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                                     Region.MENU_ITEM_ACCELERATOR, ENABLED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        accStyle.uninstallDefaults(accContext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        accContext.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        accStyle = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        super.uninstallDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    protected void uninstallListeners() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        super.uninstallListeners();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        menuItem.removePropertyChangeListener(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public SynthContext getContext(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        return getContext(c, getComponentState(c));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    SynthContext getContext(JComponent c, int state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        Region region = getRegion(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        return SynthContext.getContext(SynthContext.class, c, region,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                                       style, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    public SynthContext getContext(JComponent c, Region region) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        return getContext(c, region, getComponentState(c, region));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    private SynthContext getContext(JComponent c, Region region, int state) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        return SynthContext.getContext(SynthContext.class, c,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                                       region, accStyle, state);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    private Region getRegion(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        return SynthLookAndFeel.getRegion(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    private int getComponentState(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        int state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        if (!c.isEnabled()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            return DISABLED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        if (menuItem.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            state = MOUSE_OVER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            state = SynthLookAndFeel.getComponentState(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        if (menuItem.isSelected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            state |= SELECTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        return state;
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 int getComponentState(JComponent c, Region region) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        return getComponentState(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    protected Dimension getPreferredMenuItemSize(JComponent c,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                                                     Icon checkIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                                                     Icon arrowIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                                                     int defaultTextIconGap) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        SynthContext context = getContext(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        Dimension value = SynthMenuItemUI.getPreferredMenuItemSize(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                  context, accContext, c, checkIcon, arrowIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                  defaultTextIconGap, acceleratorDelimiter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        context.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        accContext.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    public void update(Graphics g, JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        SynthContext context = getContext(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        SynthLookAndFeel.update(context, g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        context.getPainter().paintMenuBackground(context,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                          g, 0, 0, c.getWidth(), c.getHeight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        paint(context, g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        context.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public void paint(Graphics g, JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        SynthContext context = getContext(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        paint(context, g);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        context.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    protected void paint(SynthContext context, Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        SynthContext accContext = getContext(menuItem,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                                             Region.MENU_ITEM_ACCELERATOR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        SynthStyle style = context.getStyle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        Icon checkIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        Icon arrowIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        if (useCheckAndArrow()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            // Refetch the appropriate icons for the current state
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            String prefix = getPropertyPrefix();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            checkIcon = style.getIcon(context, prefix + ".checkIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            arrowIcon = style.getIcon(context, prefix + ".arrowIcon");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            // Not needed in this case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            checkIcon = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            arrowIcon = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        SynthMenuItemUI.paint(context, accContext, g, checkIcon, arrowIcon,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                              acceleratorDelimiter, defaultTextIconGap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        accContext.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    public void paintBorder(SynthContext context, Graphics g, int x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                            int y, int w, int h) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        context.getPainter().paintMenuBorder(context, g, x, y, w, h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    public void propertyChange(PropertyChangeEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        if (SynthLookAndFeel.shouldUpdateStyle(e)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            updateStyle((JMenu)e.getSource());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    private boolean useCheckAndArrow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        return !((JMenu)menuItem).isTopLevelMenu();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
}