jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java
author weijun
Thu, 11 Dec 2014 15:19:12 +0800
changeset 28228 be83f404724d
parent 25859 3317bb8137f4
permissions -rw-r--r--
8067207: Replace concat String to append in StringBuilder parameters (client) Reviewed-by: serb Contributed-by: Otavio Santana <otaviojava@java.net>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23697
e556a715949f 8034169: Fix serial lint warnings in javax.swing
darcy
parents: 23010
diff changeset
     2
 * Copyright (c) 1997, 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: 1282
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: 1282
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: 1282
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1282
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1282
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.basic;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.swing.colorchooser.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.swing.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.swing.border.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import javax.swing.plaf.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.beans.PropertyChangeEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.beans.PropertyChangeListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import sun.swing.DefaultLookup;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * Provides the basic look and feel for a JColorChooser.
23715
54ae9dd9df73 8039074: Tidy warnings cleanup for javax.swing
yan
parents: 23697
diff changeset
    42
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * @author Tom Santos
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @author Steve Wilson
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
public class BasicColorChooserUI extends ColorChooserUI
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * JColorChooser this BasicColorChooserUI is installed on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    protected JColorChooser chooser;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    JTabbedPane tabbedPane;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    JPanel singlePanel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    JPanel previewPanelHolder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    JComponent previewPanel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    boolean isMultiPanel = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private static TransferHandler defaultTransferHandler = new ColorTransferHandler();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    64
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    65
     * The array of default color choosers.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    66
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    protected AbstractColorChooserPanel[] defaultChoosers;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    69
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    70
     * The instance of {@code ChangeListener}.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    71
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    protected ChangeListener previewListener;
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    73
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    74
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    75
     * The instance of {@code PropertyChangeListener}.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    76
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    protected PropertyChangeListener propertyChangeListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    private Handler handler;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    80
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    81
     * Returns a new instance of {@code BasicColorChooserUI}.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    82
     *
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    83
     * @param c a component
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    84
     * @return a new instance of {@code BasicColorChooserUI}
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    85
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    public static ComponentUI createUI(JComponent c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        return new BasicColorChooserUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    90
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    91
     * Returns an array of default color choosers.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    92
     *
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    93
     * @return an array of default color choosers
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
    94
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    protected AbstractColorChooserPanel[] createDefaultChoosers() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        AbstractColorChooserPanel[] panels = ColorChooserComponentFactory.getDefaultChooserPanels();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        return panels;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   100
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   101
     * Uninstalls default color choosers.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   102
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    protected void uninstallDefaultChoosers() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        AbstractColorChooserPanel[] choosers = chooser.getChooserPanels();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        for( int i = 0 ; i < choosers.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            chooser.removeChooserPanel( choosers[i] );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    public void installUI( JComponent c ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        chooser = (JColorChooser)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        super.installUI( c );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        installDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        installListeners();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        tabbedPane = new JTabbedPane();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        tabbedPane.setName("ColorChooser.tabPane");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        tabbedPane.setInheritsPopupMenu(true);
14658
67661687f722 4631925: JColor Chooser is not fully accessible
jviswana
parents: 9230
diff changeset
   121
        tabbedPane.getAccessibleContext().setAccessibleDescription(tabbedPane.getName());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        singlePanel = new JPanel(new CenterLayout());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        singlePanel.setName("ColorChooser.panel");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        singlePanel.setInheritsPopupMenu(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        chooser.setLayout( new BorderLayout() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        defaultChoosers = createDefaultChoosers();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        chooser.setChooserPanels(defaultChoosers);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        previewPanelHolder = new JPanel(new CenterLayout());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        previewPanelHolder.setName("ColorChooser.previewPanelHolder");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        if (DefaultLookup.getBoolean(chooser, this,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                                  "ColorChooser.showPreviewPanelText", true)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            String previewString = UIManager.getString(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                "ColorChooser.previewText", chooser.getLocale());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            previewPanelHolder.setBorder(new TitledBorder(previewString));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        previewPanelHolder.setInheritsPopupMenu(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        installPreviewPanel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        chooser.applyComponentOrientation(c.getComponentOrientation());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    public void uninstallUI( JComponent c ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        chooser.remove(tabbedPane);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        chooser.remove(singlePanel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        chooser.remove(previewPanelHolder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        uninstallDefaultChoosers();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        uninstallListeners();
6105
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   153
        uninstallPreviewPanel();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        uninstallDefaults();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        previewPanelHolder = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        previewPanel = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        defaultChoosers = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        chooser = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        tabbedPane = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        handler = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   165
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   166
     * Installs preview panel.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   167
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    protected void installPreviewPanel() {
6105
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   169
        JComponent previewPanel = this.chooser.getPreviewPanel();
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   170
        if (previewPanel == null) {
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   171
            previewPanel = ColorChooserComponentFactory.getPreviewPanel();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        }
6512
ce0a2790e09f 6977726: JColorChooser.getPreviewPanel() returnes null starting from jdk7 b105.
malenkov
parents: 6105
diff changeset
   173
        else if (JPanel.class.equals(previewPanel.getClass()) && (0 == previewPanel.getComponentCount())) {
ce0a2790e09f 6977726: JColorChooser.getPreviewPanel() returnes null starting from jdk7 b105.
malenkov
parents: 6105
diff changeset
   174
            previewPanel = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
6105
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   176
        this.previewPanel = previewPanel;
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   177
        if (previewPanel != null) {
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   178
            chooser.add(previewPanelHolder, BorderLayout.SOUTH);
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   179
            previewPanel.setForeground(chooser.getColor());
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   180
            previewPanelHolder.add(previewPanel);
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   181
            previewPanel.addMouseListener(getHandler());
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   182
            previewPanel.setInheritsPopupMenu(true);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        }
6105
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   184
    }
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   185
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   186
    /**
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   187
     * Removes installed preview panel from the UI delegate.
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   188
     *
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   189
     * @since 1.7
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   190
     */
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   191
    protected void uninstallPreviewPanel() {
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   192
        if (this.previewPanel != null) {
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   193
            this.previewPanel.removeMouseListener(getHandler());
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   194
            this.previewPanelHolder.remove(this.previewPanel);
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   195
        }
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   196
        this.chooser.remove(this.previewPanelHolder);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   199
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   200
     * Installs default properties.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   201
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    protected void installDefaults() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        LookAndFeel.installColorsAndFont(chooser, "ColorChooser.background",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                                              "ColorChooser.foreground",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                                              "ColorChooser.font");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        LookAndFeel.installProperty(chooser, "opaque", Boolean.TRUE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        TransferHandler th = chooser.getTransferHandler();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        if (th == null || th instanceof UIResource) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            chooser.setTransferHandler(defaultTransferHandler);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   213
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   214
     * Uninstalls default properties.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   215
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    protected void uninstallDefaults() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        if (chooser.getTransferHandler() instanceof UIResource) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            chooser.setTransferHandler(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   222
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   223
     * Registers listeners.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   224
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    protected void installListeners() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        propertyChangeListener = createPropertyChangeListener();
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   227
        chooser.addPropertyChangeListener(propertyChangeListener);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        previewListener = getHandler();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        chooser.getSelectionModel().addChangeListener(previewListener);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    private Handler getHandler() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        if (handler == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            handler = new Handler();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        return handler;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   240
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   241
     * Returns an instance of {@code PropertyChangeListener}.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   242
     *
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   243
     * @return an instance of {@code PropertyChangeListener}
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   244
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    protected PropertyChangeListener createPropertyChangeListener() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        return getHandler();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
25761
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   249
    /**
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   250
     * Unregisters listeners.
c408b10ef757 8043968: Fix doclint warnings from javax.swing.plaf.basic package, 1 of 7
aeremeev
parents: 23715
diff changeset
   251
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    protected void uninstallListeners() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        chooser.removePropertyChangeListener( propertyChangeListener );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        chooser.getSelectionModel().removeChangeListener(previewListener);
465
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   255
        previewListener = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
465
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   258
    private void selectionChanged(ColorSelectionModel model) {
6512
ce0a2790e09f 6977726: JColorChooser.getPreviewPanel() returnes null starting from jdk7 b105.
malenkov
parents: 6105
diff changeset
   259
        JComponent previewPanel = this.chooser.getPreviewPanel();
ce0a2790e09f 6977726: JColorChooser.getPreviewPanel() returnes null starting from jdk7 b105.
malenkov
parents: 6105
diff changeset
   260
        if (previewPanel != null) {
ce0a2790e09f 6977726: JColorChooser.getPreviewPanel() returnes null starting from jdk7 b105.
malenkov
parents: 6105
diff changeset
   261
            previewPanel.setForeground(model.getSelectedColor());
ce0a2790e09f 6977726: JColorChooser.getPreviewPanel() returnes null starting from jdk7 b105.
malenkov
parents: 6105
diff changeset
   262
            previewPanel.repaint();
465
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   263
        }
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   264
        AbstractColorChooserPanel[] panels = this.chooser.getChooserPanels();
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   265
        if (panels != null) {
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   266
            for (AbstractColorChooserPanel panel : panels) {
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   267
                if (panel != null) {
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   268
                    panel.updateChooser();
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   269
                }
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   270
            }
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   271
        }
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   272
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    private class Handler implements ChangeListener, MouseListener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            PropertyChangeListener {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        // ChangeListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        public void stateChanged(ChangeEvent evt) {
465
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   280
            selectionChanged((ColorSelectionModel) evt.getSource());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        // MouseListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        public void mousePressed(MouseEvent evt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
            if (chooser.getDragEnabled()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                TransferHandler th = chooser.getTransferHandler();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                th.exportAsDrag(chooser, evt, TransferHandler.COPY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        public void mouseReleased(MouseEvent evt) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        public void mouseClicked(MouseEvent evt) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        public void mouseEntered(MouseEvent evt) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        public void mouseExited(MouseEvent evt) {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        // PropertyChangeListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        public void propertyChange(PropertyChangeEvent evt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            String prop = evt.getPropertyName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            if (prop == JColorChooser.CHOOSER_PANELS_PROPERTY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                AbstractColorChooserPanel[] oldPanels =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                    (AbstractColorChooserPanel[])evt.getOldValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                AbstractColorChooserPanel[] newPanels =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                    (AbstractColorChooserPanel[])evt.getNewValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                for (int i = 0; i < oldPanels.length; i++) {  // remove old panels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                   Container wrapper = oldPanels[i].getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                    if (wrapper != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                      Container parent = wrapper.getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                      if (parent != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                          parent.remove(wrapper);  // remove from hierarchy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                      oldPanels[i].uninstallChooserPanel(chooser); // uninstall
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                int numNewPanels = newPanels.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                if (numNewPanels == 0) {  // removed all panels and added none
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                    chooser.remove(tabbedPane);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                else if (numNewPanels == 1) {  // one panel case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                    chooser.remove(tabbedPane);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                    JPanel centerWrapper = new JPanel( new CenterLayout() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                    centerWrapper.setInheritsPopupMenu(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                    centerWrapper.add(newPanels[0]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                    singlePanel.add(centerWrapper, BorderLayout.CENTER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                    chooser.add(singlePanel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
                else {   // multi-panel case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                    if ( oldPanels.length < 2 ) {// moving from single to multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                        chooser.remove(singlePanel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
                        chooser.add(tabbedPane, BorderLayout.CENTER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                    for (int i = 0; i < newPanels.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                        JPanel centerWrapper = new JPanel( new CenterLayout() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
                        centerWrapper.setInheritsPopupMenu(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
                        String name = newPanels[i].getDisplayName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
                        int mnemonic = newPanels[i].getMnemonic();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
                        centerWrapper.add(newPanels[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                        tabbedPane.addTab(name, centerWrapper);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                        if (mnemonic > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                            tabbedPane.setMnemonicAt(i, mnemonic);
1282
00a51b36c173 6552812: Add HSL tab to JColorChooser
malenkov
parents: 465
diff changeset
   346
                            int index = newPanels[i].getDisplayedMnemonicIndex();
00a51b36c173 6552812: Add HSL tab to JColorChooser
malenkov
parents: 465
diff changeset
   347
                            if (index >= 0) {
00a51b36c173 6552812: Add HSL tab to JColorChooser
malenkov
parents: 465
diff changeset
   348
                                tabbedPane.setDisplayedMnemonicIndexAt(i, index);
00a51b36c173 6552812: Add HSL tab to JColorChooser
malenkov
parents: 465
diff changeset
   349
                            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
                chooser.applyComponentOrientation(chooser.getComponentOrientation());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
                for (int i = 0; i < newPanels.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
                    newPanels[i].installChooserPanel(chooser);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
            }
465
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   358
            else if (prop == JColorChooser.PREVIEW_PANEL_PROPERTY) {
6105
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   359
                uninstallPreviewPanel();
de4af6e215ad 6199676: REGRESSION: ColorChooser loses preview when change LandF in Java5
malenkov
parents: 5506
diff changeset
   360
                installPreviewPanel();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            }
465
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   362
            else if (prop == JColorChooser.SELECTION_MODEL_PROPERTY) {
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   363
                ColorSelectionModel oldModel = (ColorSelectionModel) evt.getOldValue();
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   364
                oldModel.removeChangeListener(previewListener);
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   365
                ColorSelectionModel newModel = (ColorSelectionModel) evt.getNewValue();
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   366
                newModel.addChangeListener(previewListener);
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   367
                selectionChanged(newModel);
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   368
            }
507ce3a1af17 6348456: BasicColorChooserUI ignores JColorChooser selection model changes
malenkov
parents: 2
diff changeset
   369
            else if (prop == "componentOrientation") {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                ComponentOrientation o =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                    (ComponentOrientation)evt.getNewValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                JColorChooser cc = (JColorChooser)evt.getSource();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                if (o != (ComponentOrientation)evt.getOldValue()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                    cc.applyComponentOrientation(o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                    cc.updateUI();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * This class should be treated as a &quot;protected&quot; inner class.
9230
c5674561cb9e 6985329: 9 classes in swing.plaf contains words inappropriate for public spec - about some compiler bug
alexp
parents: 6512
diff changeset
   383
     * Instantiate it only within subclasses of {@code BasicColorChooserUI}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    public class PropertyHandler implements PropertyChangeListener {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        public void propertyChange(PropertyChangeEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            getHandler().propertyChange(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
23697
e556a715949f 8034169: Fix serial lint warnings in javax.swing
darcy
parents: 23010
diff changeset
   391
    @SuppressWarnings("serial") // JDK-implementation class
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    static class ColorTransferHandler extends TransferHandler implements UIResource {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        ColorTransferHandler() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            super("color");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
}