jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java
author yan
Mon, 30 Jun 2014 16:32:36 +0400
changeset 25178 dbab904451e9
parent 25095 c5dedd869f01
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: 1299
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: 1299
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: 1299
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1299
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1299
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 javax.swing.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.swing.plaf.UIResource;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.image.BufferedImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.swing.CachedPainter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Factory object that vends <code>Icon</code>s for
20458
f2423fb3fd19 8025840: Fix all the doclint warnings about trademark
cl
parents: 5506
diff changeset
    39
 * the Java&trade; look and feel (Metal).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * These icons are used extensively in Metal via the defaults mechanism.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * While other look and feels often use GIFs for icons, creating icons
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * in code facilitates switching to other themes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * Each method in this class returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * either an <code>Icon</code> or <code>null</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * where <code>null</code> implies that there is no default icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * 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: 5506
diff changeset
    55
 * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @author Michael C. Albers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
    61
@SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
public class MetalIconFactory implements Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    // List of code-drawn Icons
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    private static Icon fileChooserDetailViewIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    private static Icon fileChooserHomeFolderIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private static Icon fileChooserListViewIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    private static Icon fileChooserNewFolderIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    private static Icon fileChooserUpFolderIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    private static Icon internalFrameAltMaximizeIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    private static Icon internalFrameCloseIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    private static Icon internalFrameDefaultMenuIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    private static Icon internalFrameMaximizeIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private static Icon internalFrameMinimizeIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    private static Icon radioButtonIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    private static Icon treeComputerIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    private static Icon treeFloppyDriveIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    private static Icon treeHardDriveIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    private static Icon menuArrowIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    private static Icon menuItemArrowIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    private static Icon checkBoxMenuItemIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    private static Icon radioButtonMenuItemIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    private static Icon checkBoxIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    // Ocean icons
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    private static Icon oceanHorizontalSliderThumb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    private static Icon oceanVerticalSliderThumb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    // Constants
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
    93
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
    94
     * {@code DARK} is used for the property {@code Tree.expandedIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
    95
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public static final boolean DARK = false;
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
    97
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
    98
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
    99
     * {@code LIGHT} is used for the property {@code Tree.collapsedIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   100
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public static final boolean LIGHT = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    // Accessor functions for Icons. Does the caching work.
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   104
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   105
     * Returns the instance of {@code FileChooserDetailViewIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   106
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   107
     * @return the instance of {@code FileChooserDetailViewIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   108
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    public static Icon getFileChooserDetailViewIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        if (fileChooserDetailViewIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            fileChooserDetailViewIcon = new FileChooserDetailViewIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        return fileChooserDetailViewIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   116
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   117
     * Returns the instance of {@code FileChooserHomeFolderIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   118
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   119
     * @return the instance of {@code FileChooserHomeFolderIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   120
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public static Icon getFileChooserHomeFolderIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        if (fileChooserHomeFolderIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        return fileChooserHomeFolderIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   128
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   129
     * Returns the instance of {@code FileChooserListViewIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   130
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   131
     * @return the instance of {@code FileChooserListViewIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   132
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    public static Icon getFileChooserListViewIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        if (fileChooserListViewIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            fileChooserListViewIcon = new FileChooserListViewIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        return fileChooserListViewIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   140
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   141
     * Returns the instance of {@code FileChooserNewFolderIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   142
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   143
     * @return the instance of {@code FileChooserNewFolderIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   144
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public static Icon getFileChooserNewFolderIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        if (fileChooserNewFolderIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            fileChooserNewFolderIcon = new FileChooserNewFolderIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        return fileChooserNewFolderIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   152
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   153
     * Returns the instance of {@code FileChooserUpFolderIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   154
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   155
     * @return the instance of {@code FileChooserUpFolderIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   156
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    public static Icon getFileChooserUpFolderIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        if (fileChooserUpFolderIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            fileChooserUpFolderIcon = new FileChooserUpFolderIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        return fileChooserUpFolderIcon;
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: 25095
diff changeset
   164
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   165
     * Constructs a new instance of {@code InternalFrameAltMaximizeIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   166
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   167
     * @param size the size of the icon
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   168
     * @return a new instance of {@code InternalFrameAltMaximizeIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   169
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    public static Icon getInternalFrameAltMaximizeIcon(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        return new InternalFrameAltMaximizeIcon(size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   174
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   175
     * Constructs a new instance of {@code InternalFrameCloseIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   176
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   177
     * @param size the size of the icon
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   178
     * @return a new instance of {@code InternalFrameCloseIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   179
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    public static Icon getInternalFrameCloseIcon(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        return new InternalFrameCloseIcon(size);
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: 25095
diff changeset
   184
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   185
     * Returns the instance of {@code InternalFrameDefaultMenuIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   186
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   187
     * @return the instance of {@code InternalFrameDefaultMenuIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   188
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    public static Icon getInternalFrameDefaultMenuIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        if (internalFrameDefaultMenuIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        return internalFrameDefaultMenuIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   196
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   197
     * Constructs a new instance of {@code InternalFrameMaximizeIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   198
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   199
     * @param size the size of the icon
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   200
     * @return a new instance of {@code InternalFrameMaximizeIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   201
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public static Icon getInternalFrameMaximizeIcon(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        return new InternalFrameMaximizeIcon(size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   206
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   207
     * Constructs a new instance of {@code InternalFrameMinimizeIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   208
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   209
     * @param size the size of the icon
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   210
     * @return a new instance of {@code InternalFrameMinimizeIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   211
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    public static Icon getInternalFrameMinimizeIcon(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        return new InternalFrameMinimizeIcon(size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   216
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   217
     * Returns the instance of {@code RadioButtonIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   218
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   219
     * @return the instance of {@code RadioButtonIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   220
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    public static Icon getRadioButtonIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        if (radioButtonIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            radioButtonIcon = new RadioButtonIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        return radioButtonIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * Returns a checkbox icon.
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   230
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   231
     * @return a checkbox icon
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    public static Icon getCheckBoxIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        if (checkBoxIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            checkBoxIcon = new CheckBoxIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        return checkBoxIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   241
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   242
     * Returns the instance of {@code TreeComputerIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   243
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   244
     * @return the instance of {@code TreeComputerIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   245
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public static Icon getTreeComputerIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        if ( treeComputerIcon == null ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
            treeComputerIcon = new TreeComputerIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        return treeComputerIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   253
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   254
     * Returns the instance of {@code TreeFloppyDriveIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   255
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   256
     * @return the instance of {@code TreeFloppyDriveIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   257
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    public static Icon getTreeFloppyDriveIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        if ( treeFloppyDriveIcon == null ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            treeFloppyDriveIcon = new TreeFloppyDriveIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        return treeFloppyDriveIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   265
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   266
     * Constructs a new instance of {@code TreeFolderIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   267
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   268
     * @return a new instance of {@code TreeFolderIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   269
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    public static Icon getTreeFolderIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        return new TreeFolderIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   274
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   275
     * Returns the instance of {@code TreeHardDriveIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   276
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   277
     * @return the instance of {@code TreeHardDriveIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   278
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    public static Icon getTreeHardDriveIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        if ( treeHardDriveIcon == null ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            treeHardDriveIcon = new TreeHardDriveIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        return treeHardDriveIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   286
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   287
     * Constructs a new instance of {@code TreeLeafIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   288
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   289
     * @return a new instance of {@code TreeLeafIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   290
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    public static Icon getTreeLeafIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        return new TreeLeafIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   295
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   296
     * Constructs a new instance of {@code TreeControlIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   297
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   298
     * @param isCollapsed if {@code true} the icon is collapsed
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   299
     * @return a new instance of {@code TreeControlIcon}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   300
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    public static Icon getTreeControlIcon( boolean isCollapsed ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            return new TreeControlIcon( isCollapsed );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   305
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   306
     * Returns an icon to be used by {@code JMenu}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   307
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   308
     * @return an icon to be used by {@code JMenu}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   309
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    public static Icon getMenuArrowIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        if (menuArrowIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            menuArrowIcon = new MenuArrowIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        return menuArrowIcon;
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
     * Returns an icon to be used by <code>JCheckBoxMenuItem</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @return the default icon for check box menu items,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     *         or <code>null</code> if no default exists
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    public static Icon getMenuItemCheckIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   327
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   328
     * Returns an icon to be used by {@code JMenuItem}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   329
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   330
     * @return an icon to be used by {@code JMenuItem}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   331
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    public static Icon getMenuItemArrowIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        if (menuItemArrowIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            menuItemArrowIcon = new MenuItemArrowIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        return menuItemArrowIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   339
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   340
     * Returns an icon to be used by {@code JCheckBoxMenuItem}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   341
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   342
     * @return an icon to be used by {@code JCheckBoxMenuItem}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   343
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    public static Icon getCheckBoxMenuItemIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        if (checkBoxMenuItemIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            checkBoxMenuItemIcon = new CheckBoxMenuItemIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        return checkBoxMenuItemIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   351
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   352
     * Returns an icon to be used by {@code JRadioButtonMenuItem}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   353
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   354
     * @return an icon to be used by {@code JRadioButtonMenuItem}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   355
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    public static Icon getRadioButtonMenuItemIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        if (radioButtonMenuItemIcon == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            radioButtonMenuItemIcon = new RadioButtonMenuItemIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        return radioButtonMenuItemIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   363
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   364
     * Returns a thumb icon to be used by horizontal slider.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   365
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   366
     * @return a thumb icon to be used by horizontal slider
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   367
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    public static Icon getHorizontalSliderThumbIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        if (MetalLookAndFeel.usingOcean()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            if (oceanHorizontalSliderThumb == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                oceanHorizontalSliderThumb =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                               new OceanHorizontalSliderThumbIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
            return oceanHorizontalSliderThumb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
      // don't cache these, bumps don't get updated otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        return new HorizontalSliderThumbIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   380
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   381
     * Returns a thumb icon to be used by vertical slider.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   382
     *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   383
     * @return a thumb icon to be used by vertical slider
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
   384
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    public static Icon getVerticalSliderThumbIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        if (MetalLookAndFeel.usingOcean()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            if (oceanVerticalSliderThumb == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
                oceanVerticalSliderThumb = new OceanVerticalSliderThumbIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
            return oceanVerticalSliderThumb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        // don't cache these, bumps don't get updated otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        return new VerticalSliderThumbIcon();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    // File Chooser Detail View code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    private static class FileChooserDetailViewIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
            // Draw outside edge of each of the documents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
            g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
            //     top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            g.drawLine(2,2, 5,2); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
            g.drawLine(2,3, 2,7); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
            g.drawLine(3,7, 6,7); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
            g.drawLine(6,6, 6,3); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            //     bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
            g.drawLine(2,10, 5,10); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            g.drawLine(2,11, 2,15); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            g.drawLine(3,15, 6,15); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
            g.drawLine(6,14, 6,11); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
            // Draw little dots next to documents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            //     Same color as outside edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            g.drawLine(8,5, 15,5);     // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            g.drawLine(8,13, 15,13);   // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
            // Draw inner highlight on documents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
            g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
            g.drawRect(3,3, 2,3);   // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
            g.drawRect(3,11, 2,3);  // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            // Draw inner inner highlight on documents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
            g.drawLine(4,4, 4,5);     // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            g.drawLine(4,12, 4,13);   // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    }  // End class FileChooserDetailViewIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    // File Chooser Home Folder code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    private static class FileChooserHomeFolderIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
            // Draw outside edge of house
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
            g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
            g.drawLine(8,1, 1,8);  // left edge of roof
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
            g.drawLine(8,1, 15,8); // right edge of roof
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
            g.drawLine(11,2, 11,3); // left edge of chimney
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            g.drawLine(12,2, 12,4); // right edge of chimney
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
            g.drawLine(3,7, 3,15); // left edge of house
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            g.drawLine(13,7, 13,15); // right edge of house
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            g.drawLine(4,15, 12,15); // bottom edge of house
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
            // Draw door frame
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
            //     same color as edge of house
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            g.drawLine( 6,9,  6,14); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
            g.drawLine(10,9, 10,14); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
            g.drawLine( 7,9,  9, 9); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
            // Draw roof body
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
            g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
            g.fillRect(8,2, 1,1); //top toward bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
            g.fillRect(7,3, 3,1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
            g.fillRect(6,4, 5,1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
            g.fillRect(5,5, 7,1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            g.fillRect(4,6, 9,2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
            // Draw doornob
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
            //     same color as roof body
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
            g.drawLine(9,12, 9,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
            // Paint the house
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
            g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
            g.drawLine(4,8, 12,8); // above door
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
            g.fillRect(4,9, 2,6); // left of door
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            g.fillRect(11,9, 2,6); // right of door
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    }  // End class FileChooserHomeFolderIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    // File Chooser List View code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    private static class FileChooserListViewIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
            // Draw outside edge of each of the documents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
            g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
            //     top left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
            g.drawLine(2,2, 5,2); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
            g.drawLine(2,3, 2,7); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
            g.drawLine(3,7, 6,7); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            g.drawLine(6,6, 6,3); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
            //     top right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
            g.drawLine(10,2, 13,2); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
            g.drawLine(10,3, 10,7); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
            g.drawLine(11,7, 14,7); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
            g.drawLine(14,6, 14,3); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
            //     bottom left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
            g.drawLine(2,10, 5,10); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
            g.drawLine(2,11, 2,15); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
            g.drawLine(3,15, 6,15); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
            g.drawLine(6,14, 6,11); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
            //     bottom right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
            g.drawLine(10,10, 13,10); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
            g.drawLine(10,11, 10,15); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
            g.drawLine(11,15, 14,15); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
            g.drawLine(14,14, 14,11); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
            // Draw little dots next to documents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
            //     Same color as outside edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
            g.drawLine(8,5, 8,5);     // top left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
            g.drawLine(16,5, 16,5);   // top right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
            g.drawLine(8,13, 8,13);   // bottom left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
            g.drawLine(16,13, 16,13); // bottom right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
            // Draw inner highlight on documents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
            g.drawRect(3,3, 2,3);   // top left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
            g.drawRect(11,3, 2,3);  // top right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
            g.drawRect(3,11, 2,3);  // bottom left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
            g.drawRect(11,11, 2,3); // bottom right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
            // Draw inner inner highlight on documents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
            g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
            g.drawLine(4,4, 4,5);     // top left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
            g.drawLine(12,4, 12,5);   // top right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
            g.drawLine(4,12, 4,13);   // bottom left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
            g.drawLine(12,12, 12,13); // bottom right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
    }  // End class FileChooserListViewIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    // File Chooser New Folder code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    private static class FileChooserNewFolderIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
            // Fill background
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
            g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
            g.fillRect(3,5, 12,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
            // Draw outside edge of folder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
            g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
            g.drawLine(1,6,    1,14); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
            g.drawLine(2,14,  15,14); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
            g.drawLine(15,13, 15,5);  // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
            g.drawLine(2,5,    9,5);  // top left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
            g.drawLine(10,6,  14,6);  // top right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
            // Draw inner folder highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
            g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
            g.drawLine( 2,6,  2,13); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
            g.drawLine( 3,6,  9,6);  // top left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
            g.drawLine(10,7, 14,7);  // top right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
            // Draw tab on folder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
            g.drawLine(11,3, 15,3); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
            g.drawLine(10,4, 15,4); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    }  // End class FileChooserNewFolderIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    // File Chooser Up Folder code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    private static class FileChooserUpFolderIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
            // Fill background
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
            g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
            g.fillRect(3,5, 12,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
            // Draw outside edge of folder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
            g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
            g.drawLine(1,6,    1,14); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
            g.drawLine(2,14,  15,14); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
            g.drawLine(15,13, 15,5);  // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
            g.drawLine(2,5,    9,5);  // top left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
            g.drawLine(10,6,  14,6);  // top right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
            // Draw the UP arrow
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
            //     same color as edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
            g.drawLine(8,13,  8,16); // arrow shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
            g.drawLine(8, 9,  8, 9); // arrowhead top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
            g.drawLine(7,10,  9,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
            g.drawLine(6,11, 10,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
            g.drawLine(5,12, 11,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
            // Draw inner folder highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
            g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
            g.drawLine( 2,6,  2,13); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
            g.drawLine( 3,6,  9,6);  // top left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
            g.drawLine(10,7, 14,7);  // top right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
            // Draw tab on folder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
            g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
            g.drawLine(11,3, 15,3); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
            g.drawLine(10,4, 15,4); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
            return 18;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    }  // End class FileChooserUpFolderIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     * Defines an icon for Palette close
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    public static class PaletteCloseIcon implements Icon, UIResource, Serializable{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
        int iconSize = 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
            JButton parentButton = (JButton)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
            ButtonModel buttonModel = parentButton.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
            Color back;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
            Color highlight = MetalLookAndFeel.getPrimaryControlHighlight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
            Color shadow = MetalLookAndFeel.getPrimaryControlInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
            if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
                back = shadow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
                back = MetalLookAndFeel.getPrimaryControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
            g.setColor(back);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            g.drawLine( 0, 1, 5, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
            g.drawLine( 1, 0, 6, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
            g.drawLine( 1, 1, 6, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
            g.drawLine( 6, 1, 1, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
            g.drawLine( 5,0, 0,5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
            g.drawLine(5,1, 1,5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
            g.setColor(highlight);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
            g.drawLine(6,2, 5,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
            g.drawLine(2,6, 3, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
            g.drawLine(6,6,6,6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
    // Internal Frame Close code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
    private static class InternalFrameCloseIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
        int iconSize = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
        public InternalFrameCloseIcon(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
            iconSize = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
            JButton parentButton = (JButton)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
            ButtonModel buttonModel = parentButton.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
            Color backgroundColor = MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
            Color internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
            Color mainItemColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
                MetalLookAndFeel.getPrimaryControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
            Color darkHighlightColor = MetalLookAndFeel.getBlack();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
            Color xLightHighlightColor = MetalLookAndFeel.getWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
            Color boxLightHighlightColor = MetalLookAndFeel.getWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
            // if the inactive window
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
            if (parentButton.getClientProperty("paintActive") != Boolean.TRUE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
                backgroundColor = MetalLookAndFeel.getControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
                internalBackgroundColor = backgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
                mainItemColor = MetalLookAndFeel.getControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
                // if inactive and pressed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
                if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
                    internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
                        MetalLookAndFeel.getControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
                    xLightHighlightColor = internalBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
                    mainItemColor = darkHighlightColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
            // if pressed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
            else if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
                internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
                    MetalLookAndFeel.getPrimaryControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
                xLightHighlightColor = internalBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
                mainItemColor = darkHighlightColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
                // darkHighlightColor is still "getBlack()"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
            // Some calculations that are needed more than once later on.
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 453
diff changeset
   731
            int oneHalf = iconSize / 2; // 16 -> 8
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
            // fill background
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
            g.setColor(backgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
            g.fillRect(0,0, iconSize,iconSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
            // fill inside of box area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
            g.setColor(internalBackgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
            g.fillRect(3,3, iconSize-6,iconSize-6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
            // THE BOX
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
            // the top/left dark higlight - some of this will get overwritten
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
            g.drawRect(1,1, iconSize-3,iconSize-3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
            // draw the inside bottom/right highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
            g.drawRect(2,2, iconSize-5,iconSize-5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
            // draw the light/outside, bottom/right highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
            g.setColor(boxLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
            g.drawRect(2,2, iconSize-3,iconSize-3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
            // draw the "normal" box
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
            g.drawRect(2,2, iconSize-4,iconSize-4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
            g.drawLine(3,iconSize-3, 3,iconSize-3); // lower left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
            g.drawLine(iconSize-3,3, iconSize-3,3); // up right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
            // THE "X"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
            // Dark highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
            g.drawLine(4,5, 5,4); // far up left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
            g.drawLine(4,iconSize-6, iconSize-6,4); // against body of "X"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
            // Light highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
            g.setColor(xLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
            g.drawLine(6,iconSize-5, iconSize-5,6); // against body of "X"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
              // one pixel over from the body
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
            g.drawLine(oneHalf,oneHalf+2, oneHalf+2,oneHalf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
              // bottom right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
            g.drawLine(iconSize-5,iconSize-5, iconSize-4,iconSize-5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
            g.drawLine(iconSize-5,iconSize-4, iconSize-5,iconSize-4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
            // Main color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
              // Upper left to lower right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
            g.drawLine(5,5, iconSize-6,iconSize-6); // g.drawLine(5,5, 10,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
            g.drawLine(6,5, iconSize-5,iconSize-6); // g.drawLine(6,5, 11,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
            g.drawLine(5,6, iconSize-6,iconSize-5); // g.drawLine(5,6, 10,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
              // Lower left to upper right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
            g.drawLine(5,iconSize-5, iconSize-5,5); // g.drawLine(5,11, 11,5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
            g.drawLine(5,iconSize-6, iconSize-6,5); // g.drawLine(5,10, 10,5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
    }  // End class InternalFrameCloseIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
    // Internal Frame Alternate Maximize code (actually, the un-maximize icon)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
    private static class InternalFrameAltMaximizeIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
        int iconSize = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
        public InternalFrameAltMaximizeIcon(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
            iconSize = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
            JButton parentButton = (JButton)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
            ButtonModel buttonModel = parentButton.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
            Color backgroundColor = MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
            Color internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
                MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
            Color mainItemColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
                MetalLookAndFeel.getPrimaryControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
            Color darkHighlightColor = MetalLookAndFeel.getBlack();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
            // ul = Upper Left and lr = Lower Right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
            Color ulLightHighlightColor = MetalLookAndFeel.getWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
            Color lrLightHighlightColor = MetalLookAndFeel.getWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
            // if the internal frame is inactive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
            if (parentButton.getClientProperty("paintActive") != Boolean.TRUE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
                backgroundColor = MetalLookAndFeel.getControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
                internalBackgroundColor = backgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
                mainItemColor = MetalLookAndFeel.getControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
                // if inactive and pressed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
                if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
                    internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
                        MetalLookAndFeel.getControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
                    ulLightHighlightColor = internalBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
                    mainItemColor = darkHighlightColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
            // if the button is pressed and the mouse is over it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
            else if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
                internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
                    MetalLookAndFeel.getPrimaryControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
                ulLightHighlightColor = internalBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
                mainItemColor = darkHighlightColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
                // darkHighlightColor is still "getBlack()"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
            // fill background
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
            g.setColor(backgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
            g.fillRect(0,0, iconSize,iconSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
            // BOX
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
            // fill inside the box
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
            g.setColor(internalBackgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
            g.fillRect(3,6, iconSize-9,iconSize-9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
            // draw dark highlight color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
            g.drawRect(1,5, iconSize-8,iconSize-8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
            g.drawLine(1,iconSize-2, 1,iconSize-2); // extra pixel on bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
            // draw lower right light highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
            g.setColor(lrLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
            g.drawRect(2,6, iconSize-7,iconSize-7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
            // draw upper left light highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
            g.setColor(ulLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
            g.drawRect(3,7, iconSize-9,iconSize-9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
            // draw the main box
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
            g.drawRect(2,6, iconSize-8,iconSize-8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
            // Six extraneous pixels to deal with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
            g.setColor(ulLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
            g.drawLine(iconSize-6,8,iconSize-6,8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
            g.drawLine(iconSize-9,6, iconSize-7,8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
            g.drawLine(3,iconSize-3,3,iconSize-3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
            g.drawLine(iconSize-6,9,iconSize-6,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
            g.setColor(backgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
            g.drawLine(iconSize-9,5,iconSize-9,5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
            // ARROW
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
            // do the shaft first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
            g.fillRect(iconSize-7,3, 3,5); // do a big block
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
            g.drawLine(iconSize-6,5, iconSize-3,2); // top shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
            g.drawLine(iconSize-6,6, iconSize-2,2); // bottom shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
            g.drawLine(iconSize-6,7, iconSize-3,7); // bottom arrow head
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
            // draw the dark highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
            g.drawLine(iconSize-8,2, iconSize-7,2); // top of arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
            g.drawLine(iconSize-8,3, iconSize-8,7); // left of arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
            g.drawLine(iconSize-6,4, iconSize-3,1); // top of shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
            g.drawLine(iconSize-4,6, iconSize-3,6); // top,right of arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
            // draw the light highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
            g.setColor(lrLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
            g.drawLine(iconSize-6,3, iconSize-6,3); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
            g.drawLine(iconSize-4,5, iconSize-2,3); // under shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
            g.drawLine(iconSize-4,8, iconSize-3,8); // under arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
            g.drawLine(iconSize-2,8, iconSize-2,7); // right of arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
    }  // End class InternalFrameAltMaximizeIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
    // Code for the default icons that goes in the upper left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
    private static class InternalFrameDefaultMenuIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
            Color windowBodyColor = MetalLookAndFeel.getWindowBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
            Color titleColor = MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
            Color edgeColor = MetalLookAndFeel.getPrimaryControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
            // draw background color for title area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
            // catch four corners and title area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
            g.setColor(titleColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
            g.fillRect(0,0, 16,16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
            // fill body of window
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
            g.setColor(windowBodyColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
            g.fillRect(2,6, 13,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
            // draw light parts of two "bumps"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
            g.drawLine(2,2, 2,2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
            g.drawLine(5,2, 5,2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
            g.drawLine(8,2, 8,2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
            g.drawLine(11,2, 11,2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
            // draw line around edge of title and icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
            g.setColor(edgeColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
            g.drawRect(1,1, 13,13); // entire inner edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
            g.drawLine(1,0, 14,0); // top outter edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
            g.drawLine(15,1, 15,14); // right outter edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
            g.drawLine(1,15, 14,15); // bottom outter edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
            g.drawLine(0,1, 0,14); // left outter edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
            g.drawLine(2,5, 13,5); // bottom of title bar area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
            // draw dark part of four "bumps" (same color)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
            g.drawLine(3,3, 3,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
            g.drawLine(6,3, 6,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
            g.drawLine(9,3, 9,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
            g.drawLine(12,3, 12,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
    }  // End class InternalFrameDefaultMenuIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
    // Internal Frame Maximize code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
    private static class InternalFrameMaximizeIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
        protected int iconSize = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
        public InternalFrameMaximizeIcon(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
            iconSize = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
            JButton parentButton = (JButton)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
            ButtonModel buttonModel = parentButton.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
            Color backgroundColor = MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
            Color internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
                MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
            Color mainItemColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
                MetalLookAndFeel.getPrimaryControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
            Color darkHighlightColor = MetalLookAndFeel.getBlack();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
            // ul = Upper Left and lr = Lower Right
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
            Color ulLightHighlightColor = MetalLookAndFeel.getWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
            Color lrLightHighlightColor = MetalLookAndFeel.getWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
            // if the internal frame is inactive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
            if (parentButton.getClientProperty("paintActive") != Boolean.TRUE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
                backgroundColor = MetalLookAndFeel.getControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
                internalBackgroundColor = backgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
                mainItemColor = MetalLookAndFeel.getControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
                // if inactive and pressed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
                if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
                    internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
                        MetalLookAndFeel.getControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
                    ulLightHighlightColor = internalBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
                    mainItemColor = darkHighlightColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
            // if the button is pressed and the mouse is over it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
            else if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
                internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
                    MetalLookAndFeel.getPrimaryControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
                ulLightHighlightColor = internalBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
                mainItemColor = darkHighlightColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
                // darkHighlightColor is still "getBlack()"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
            // fill background
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
            g.setColor(backgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
            g.fillRect(0,0, iconSize,iconSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
            // BOX drawing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
            // fill inside the box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
            g.setColor(internalBackgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
            g.fillRect(3,7, iconSize-10,iconSize-10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
            // light highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
            g.setColor(ulLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
            g.drawRect(3,7, iconSize-10,iconSize-10); // up,left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
            g.setColor(lrLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
            g.drawRect(2,6, iconSize-7,iconSize-7); // low,right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
            // dark highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
            g.drawRect(1,5, iconSize-7,iconSize-7); // outer
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
            g.drawRect(2,6, iconSize-9,iconSize-9); // inner
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
            // main box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
            g.drawRect(2,6, iconSize-8,iconSize-8); // g.drawRect(2,6, 8,8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
            // ARROW drawing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
            // dark highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
              // down,left to up,right - inside box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
            g.drawLine(3,iconSize-5, iconSize-9,7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
              // down,left to up,right - outside box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
            g.drawLine(iconSize-6,4, iconSize-5,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
              // outside edge of arrow head
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
            g.drawLine(iconSize-7,1, iconSize-7,2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
              // outside edge of arrow head
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
            g.drawLine(iconSize-6,1, iconSize-2,1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
            // light highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
            g.setColor(ulLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
              // down,left to up,right - inside box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
            g.drawLine(5,iconSize-4, iconSize-8,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
            g.setColor(lrLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
            g.drawLine(iconSize-6,3, iconSize-4,5); // outside box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
            g.drawLine(iconSize-4,5, iconSize-4,6); // one down from this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
            g.drawLine(iconSize-2,7, iconSize-1,7); // outside edge arrow head
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
            g.drawLine(iconSize-1,2, iconSize-1,6); // outside edge arrow head
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
            // main part of arrow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
            g.drawLine(3,iconSize-4, iconSize-3,2); // top edge of staff
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
            g.drawLine(3,iconSize-3, iconSize-2,2); // bottom edge of staff
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
            g.drawLine(4,iconSize-3, 5,iconSize-3); // highlights inside of box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
            g.drawLine(iconSize-7,8, iconSize-7,9); // highlights inside of box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
            g.drawLine(iconSize-6,2, iconSize-4,2); // top of arrow head
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
            g.drawRect(iconSize-3,3, 1,3); // right of arrow head
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
    }  // End class InternalFrameMaximizeIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
    // Internal Frame Minimize code
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
    private static class InternalFrameMinimizeIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
        int iconSize = 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
        public InternalFrameMinimizeIcon(int size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
            iconSize = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
            JButton parentButton = (JButton)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
            ButtonModel buttonModel = parentButton.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
            Color backgroundColor = MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
            Color internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
                MetalLookAndFeel.getPrimaryControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
            Color mainItemColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
                MetalLookAndFeel.getPrimaryControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
            Color darkHighlightColor = MetalLookAndFeel.getBlack();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
            // ul = Upper Left and lr = Lower Right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
            Color ulLightHighlightColor = MetalLookAndFeel.getWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
            Color lrLightHighlightColor = MetalLookAndFeel.getWhite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
            // if the internal frame is inactive
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
            if (parentButton.getClientProperty("paintActive") != Boolean.TRUE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
                backgroundColor = MetalLookAndFeel.getControl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
                internalBackgroundColor = backgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
                mainItemColor = MetalLookAndFeel.getControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
                // if inactive and pressed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
                if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
                    internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
                        MetalLookAndFeel.getControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
                    ulLightHighlightColor = internalBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
                    mainItemColor = darkHighlightColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
            // if the button is pressed and the mouse is over it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
            else if (buttonModel.isPressed() && buttonModel.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
                internalBackgroundColor =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
                    MetalLookAndFeel.getPrimaryControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
                ulLightHighlightColor = internalBackgroundColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
                mainItemColor = darkHighlightColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
                // darkHighlightColor is still "getBlack()"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
            // fill background
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
            g.setColor(backgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
            g.fillRect(0,0, iconSize,iconSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
            // BOX drawing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
            // fill inside the box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
            g.setColor(internalBackgroundColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
            g.fillRect(4,11, iconSize-13,iconSize-13);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
            // light highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
            g.setColor(lrLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
            g.drawRect(2,10, iconSize-10,iconSize-11); // low,right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
            g.setColor(ulLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
            g.drawRect(3,10, iconSize-12,iconSize-12); // up,left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
            // dark highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
            g.drawRect(1,8, iconSize-10,iconSize-10); // outer
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
            g.drawRect(2,9, iconSize-12,iconSize-12); // inner
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
            // main box
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
            g.drawRect(2,9, iconSize-11,iconSize-11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
            g.drawLine(iconSize-10,10, iconSize-10,10); // up right highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
            g.drawLine(3,iconSize-3, 3,iconSize-3); // low left highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
            // ARROW
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
            // do the shaft first
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
            g.setColor(mainItemColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
            g.fillRect(iconSize-7,3, 3,5); // do a big block
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
            g.drawLine(iconSize-6,5, iconSize-3,2); // top shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
            g.drawLine(iconSize-6,6, iconSize-2,2); // bottom shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
            g.drawLine(iconSize-6,7, iconSize-3,7); // bottom arrow head
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
            // draw the dark highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
            g.setColor(darkHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
            g.drawLine(iconSize-8,2, iconSize-7,2); // top of arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
            g.drawLine(iconSize-8,3, iconSize-8,7); // left of arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
            g.drawLine(iconSize-6,4, iconSize-3,1); // top of shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
            g.drawLine(iconSize-4,6, iconSize-3,6); // top,right of arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
            // draw the light highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
            g.setColor(lrLightHighlightColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
            g.drawLine(iconSize-6,3, iconSize-6,3); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
            g.drawLine(iconSize-4,5, iconSize-2,3); // under shaft
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
            g.drawLine(iconSize-7,8, iconSize-3,8); // under arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
            g.drawLine(iconSize-2,8, iconSize-2,7); // right of arrowhead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
            return iconSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
    }  // End class InternalFrameMinimizeIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
    private static class CheckBoxIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
        protected int getControlSize() { return 13; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
        private void paintOceanIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
            ButtonModel model = ((JCheckBox)c).getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
            int w = getIconWidth();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
            int h = getIconHeight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
            if ( model.isEnabled() ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
                if (model.isPressed() && model.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
                    g.setColor(MetalLookAndFeel.getControlShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
                    g.fillRect(0, 0, w, h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
                    g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
                    g.fillRect(0, 0, w, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
                    g.fillRect(0, 2, 2, h - 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
                    g.fillRect(w - 1, 1, 1, h - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
                    g.fillRect(1, h - 1, w - 2, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
                } else if (model.isRollover()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
                    MetalUtils.drawGradient(c, g, "CheckBox.gradient", 0, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
                                            w, h, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
                    g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
                    g.drawRect(0, 0, w - 1, h - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
                    g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
                    g.drawRect(1, 1, w - 3, h - 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
                    g.drawRect(2, 2, w - 5, h - 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
                    MetalUtils.drawGradient(c, g, "CheckBox.gradient", 0, 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
                                            w, h, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
                    g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
                    g.drawRect(0, 0, w - 1, h - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
                g.setColor( MetalLookAndFeel.getControlInfo() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
                g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
                g.drawRect(0, 0, w - 1, h - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
            if (model.isSelected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
                drawCheck(c,g,x,y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
            if (MetalLookAndFeel.usingOcean()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
                paintOceanIcon(c, g, x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
            ButtonModel model = ((JCheckBox)c).getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
            int controlSize = getControlSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
            if ( model.isEnabled() ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
                if (model.isPressed() && model.isArmed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
                    g.setColor( MetalLookAndFeel.getControlShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
                    g.fillRect( x, y, controlSize-1, controlSize-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
                    MetalUtils.drawPressed3DBorder(g, x, y, controlSize, controlSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
                    MetalUtils.drawFlush3DBorder(g, x, y, controlSize, controlSize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
                g.setColor(c.getForeground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
                g.setColor( MetalLookAndFeel.getControlShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
                g.drawRect( x, y, controlSize-2, controlSize-2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
            if (model.isSelected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
                drawCheck(c,g,x,y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
        protected void drawCheck(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
            int controlSize = getControlSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
            g.fillRect( x+3, y+5, 2, controlSize-8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
            g.drawLine( x+(controlSize-4), y+3, x+5, y+(controlSize-6) );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
            g.drawLine( x+(controlSize-4), y+4, x+5, y+(controlSize-5) );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
            return getControlSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
            return getControlSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
    } // End class CheckBoxIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
    // Radio button code
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
    private static class RadioButtonIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
        public void paintOceanIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
            ButtonModel model = ((JRadioButton)c).getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
            boolean enabled = model.isEnabled();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
            boolean pressed = (enabled && model.isPressed() &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
                               model.isArmed());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
            boolean rollover = (enabled && model.isRollover());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
            if (enabled && !pressed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
                // PENDING: this isn't quite right, when we're sure it won't
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
                // change it needs to be cleaned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
                MetalUtils.drawGradient(c, g, "RadioButton.gradient",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
                                        1, 1, 10, 10, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
                g.setColor(c.getBackground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
                g.fillRect(1, 1, 1, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
                g.fillRect(10, 1, 1, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
                g.fillRect(1, 10, 1, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
                g.fillRect(10, 10, 1, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
            else if (pressed || !enabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
                if (pressed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
                    g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
                    g.setColor(MetalLookAndFeel.getControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
                g.fillRect(2, 2, 8, 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
                g.fillRect(4, 1, 4, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
                g.fillRect(4, 10, 4, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
                g.fillRect(1, 4, 1, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
                g.fillRect(10, 4, 1, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
            // draw Dark Circle (start at top, go clockwise)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
            if (!enabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
                g.setColor(MetalLookAndFeel.getInactiveControlTextColor());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
                g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
            g.drawLine( 4, 0,  7, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
            g.drawLine( 8, 1,  9, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
            g.drawLine(10, 2, 10, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
            g.drawLine(11, 4, 11, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
            g.drawLine(10, 8, 10, 9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
            g.drawLine( 9,10,  8,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
            g.drawLine( 7,11,  4,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
            g.drawLine( 3,10,  2,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
            g.drawLine( 1, 9,  1, 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
            g.drawLine( 0, 7,  0, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
            g.drawLine( 1, 3,  1, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
            g.drawLine( 2, 1,  3, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
            if (pressed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
                g.fillRect(1, 4, 1, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
                g.fillRect(2, 2, 1, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
                g.fillRect(3, 2, 1, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
                g.fillRect(4, 1, 4, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
            else if (rollover) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
                g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
                g.fillRect(4, 1, 4, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
                g.fillRect(8, 2, 2, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
                g.fillRect(9, 4, 2, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
                g.fillRect(8, 8, 2, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
                g.fillRect(4, 9, 4, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
                g.fillRect(2, 8, 2, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
                g.fillRect(1, 4, 2, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
                g.fillRect(2, 2, 2, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
            // selected dot
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
            if (model.isSelected()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
                if (enabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
                    g.setColor(MetalLookAndFeel.getControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
                    g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
                g.fillRect( 4, 4,  4, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
                g.drawLine( 4, 3,  7, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
                g.drawLine( 8, 4,  8, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
                g.drawLine( 7, 8,  4, 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
                g.drawLine( 3, 7,  3, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
            if (MetalLookAndFeel.usingOcean()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
                paintOceanIcon(c, g, x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
            JRadioButton rb = (JRadioButton)c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
            ButtonModel model = rb.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
            boolean drawDot = model.isSelected();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
            Color background = c.getBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
            Color dotColor = c.getForeground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
            Color shadow = MetalLookAndFeel.getControlShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
            Color darkCircle = MetalLookAndFeel.getControlDarkShadow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
            Color whiteInnerLeftArc = MetalLookAndFeel.getControlHighlight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
            Color whiteOuterRightArc = MetalLookAndFeel.getControlHighlight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
            Color interiorColor = background;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
            // Set up colors per RadioButtonModel condition
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
            if ( !model.isEnabled() ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
                whiteInnerLeftArc = whiteOuterRightArc = background;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
                darkCircle = dotColor = shadow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
            else if (model.isPressed() && model.isArmed() ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
                whiteInnerLeftArc = interiorColor = shadow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
            // fill interior
25095
c5dedd869f01 8041561: Inconsistent opacity behaviour between JCheckBox and JRadioButton
alexsch
parents: 22574
diff changeset
  1383
            if (c.isOpaque()) {
c5dedd869f01 8041561: Inconsistent opacity behaviour between JCheckBox and JRadioButton
alexsch
parents: 22574
diff changeset
  1384
                g.setColor(interiorColor);
c5dedd869f01 8041561: Inconsistent opacity behaviour between JCheckBox and JRadioButton
alexsch
parents: 22574
diff changeset
  1385
                g.fillRect(2, 2, 9, 9);
c5dedd869f01 8041561: Inconsistent opacity behaviour between JCheckBox and JRadioButton
alexsch
parents: 22574
diff changeset
  1386
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
            // draw Dark Circle (start at top, go clockwise)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
            g.setColor(darkCircle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
            g.drawLine( 4, 0,  7, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
            g.drawLine( 8, 1,  9, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
            g.drawLine(10, 2, 10, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
            g.drawLine(11, 4, 11, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
            g.drawLine(10, 8, 10, 9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
            g.drawLine( 9,10,  8,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
            g.drawLine( 7,11,  4,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
            g.drawLine( 3,10,  2,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
            g.drawLine( 1, 9,  1, 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
            g.drawLine( 0, 7,  0, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
            g.drawLine( 1, 3,  1, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
            g.drawLine( 2, 1,  3, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
            // draw Inner Left (usually) White Arc
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
            //  start at lower left corner, go clockwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
            g.setColor(whiteInnerLeftArc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
            g.drawLine( 2, 9,  2, 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
            g.drawLine( 1, 7,  1, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
            g.drawLine( 2, 2,  2, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
            g.drawLine( 2, 2,  3, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
            g.drawLine( 4, 1,  7, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
            g.drawLine( 8, 2,  9, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
            // draw Outer Right White Arc
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
            //  start at upper right corner, go clockwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
            g.setColor(whiteOuterRightArc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1415
            g.drawLine(10, 1, 10, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
            g.drawLine(11, 2, 11, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
            g.drawLine(12, 4, 12, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
            g.drawLine(11, 8, 11, 9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
            g.drawLine(10,10, 10,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
            g.drawLine( 9,11,  8,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1421
            g.drawLine( 7,12,  4,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1422
            g.drawLine( 3,11,  2,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1423
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1424
            // selected dot
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1425
            if ( drawDot ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
                g.setColor(dotColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
                g.fillRect( 4, 4,  4, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
                g.drawLine( 4, 3,  7, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
                g.drawLine( 8, 4,  8, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
                g.drawLine( 7, 8,  4, 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
                g.drawLine( 3, 7,  3, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
            return 13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
            return 13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
    }  // End class RadioButtonIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1446
    // Tree Computer Icon code
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
    private static class TreeComputerIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
            // Fill glass portion of monitor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
            g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
            g.fillRect(5,4, 6,4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
            // Draw outside edge of monitor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
            g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
            g.drawLine( 2,2,  2,8); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
            g.drawLine(13,2, 13,8); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1459
            g.drawLine( 3,1, 12,1); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
            g.drawLine(12,9, 12,9); // bottom right base
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
            g.drawLine( 3,9,  3,9); // bottom left base
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
            // Draw the edge of the glass
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
            g.drawLine( 4,4,  4,7); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1464
            g.drawLine( 5,3, 10,3); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
            g.drawLine(11,4, 11,7); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
            g.drawLine( 5,8, 10,8); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
            // Draw the edge of the CPU
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
            g.drawLine( 1,10, 14,10); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
            g.drawLine(14,10, 14,14); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
            g.drawLine( 1,14, 14,14); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
            g.drawLine( 1,10,  1,14); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1473
            // Draw the disk drives
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1474
            g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1475
            g.drawLine( 6,12,  8,12); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
            g.drawLine(10,12, 12,12); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1480
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1481
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
    }  // End class TreeComputerIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
    // Tree HardDrive Icon code
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
    private static class TreeHardDriveIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1494
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1495
            // Draw edges of the disks
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
            g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
            //     top disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
            g.drawLine(1,4, 1,5); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
            g.drawLine(2,3, 3,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
            g.drawLine(4,2, 11,2); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
            g.drawLine(12,3, 13,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1502
            g.drawLine(14,4, 14,5); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1503
            g.drawLine(12,6, 13,6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1504
            g.drawLine(4,7, 11,7); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1505
            g.drawLine(2,6, 3,6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1506
            //     middle disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
            g.drawLine(1,7, 1,8); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
            g.drawLine(2,9, 3,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
            g.drawLine(4,10, 11,10); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
            g.drawLine(12,9, 13,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
            g.drawLine(14,7, 14, 8); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1512
            //     bottom disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1513
            g.drawLine(1,10, 1,11); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
            g.drawLine(2,12, 3,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
            g.drawLine(4,13, 11,13); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
            g.drawLine(12,12, 13,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
            g.drawLine(14,10, 14,11); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
            // Draw the down right shadows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
            g.setColor(MetalLookAndFeel.getControlShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
            //     top disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
            g.drawLine(7,6, 7,6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
            g.drawLine(9,6, 9,6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
            g.drawLine(10,5, 10,5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
            g.drawLine(11,6, 11,6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
            g.drawLine(12,5, 13,5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
            g.drawLine(13,4, 13,4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
            //     middle disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
            g.drawLine(7,9, 7,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
            g.drawLine(9,9, 9,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1531
            g.drawLine(10,8, 10,8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
            g.drawLine(11,9, 11,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
            g.drawLine(12,8, 13,8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
            g.drawLine(13,7, 13,7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
            //     bottom disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
            g.drawLine(7,12, 7,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
            g.drawLine(9,12, 9,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
            g.drawLine(10,11, 10,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1539
            g.drawLine(11,12, 11,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1540
            g.drawLine(12,11, 13,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
            g.drawLine(13,10, 13,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
            // Draw the up left highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
            g.setColor(MetalLookAndFeel.getControlHighlight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
            //     top disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
            g.drawLine(4,3, 5,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
            g.drawLine(7,3, 9,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1548
            g.drawLine(11,3, 11,3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1549
            g.drawLine(2,4, 6,4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
            g.drawLine(8,4, 8,4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
            g.drawLine(2,5, 3,5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
            g.drawLine(4,6, 4,6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
            //     middle disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
            g.drawLine(2,7, 3,7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
            g.drawLine(2,8, 3,8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
            g.drawLine(4,9, 4,9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1557
            //     bottom disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1558
            g.drawLine(2,10, 3,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
            g.drawLine(2,11, 3,11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
            g.drawLine(4,12, 4,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1562
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1563
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1567
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1568
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1572
    }  // End class TreeHardDriveIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1573
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
    // Tree FloppyDrive Icon code
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
    private static class TreeFloppyDriveIcon implements Icon, UIResource, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1577
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1578
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
            // Fill body of floppy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
            g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
            g.fillRect(2,2, 12,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1582
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1583
            // Draw outside edge of floppy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
            g.setColor(MetalLookAndFeel.getPrimaryControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
            g.drawLine( 1, 1, 13, 1); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
            g.drawLine(14, 2, 14,14); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1587
            g.drawLine( 1,14, 14,14); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1588
            g.drawLine( 1, 1,  1,14); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
            // Draw grey-ish highlights
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
            g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1592
            g.fillRect(5,2, 6,5); // metal disk protector part
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1593
            g.drawLine(4,8, 11,8); // top of label
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
            g.drawLine(3,9, 3,13); // left of label
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
            g.drawLine(12,9, 12,13); // right of label
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1597
            // Draw label and exposed disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1598
            g.setColor(MetalLookAndFeel.getPrimaryControlHighlight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
            g.fillRect(8,3, 2,3); // exposed disk
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
            g.fillRect(4,9, 8,5); // label
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
            // Draw text on label
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
            g.setColor(MetalLookAndFeel.getPrimaryControlShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
            g.drawLine(5,10, 9,10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
            g.drawLine(5,12, 8,12);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1606
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1607
            g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1611
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1612
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1613
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1614
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1615
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1616
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1617
    }  // End class TreeFloppyDriveIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1618
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
    static private final Dimension folderIcon16Size = new Dimension( 16, 16 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1621
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1622
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
     * Utility class for caching icon images.  This is necessary because
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
     * we need a new image whenever we are rendering into a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
     * GraphicsConfiguration, but we do not want to keep recreating icon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1626
     * images for GC's that we have already seen (for example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1627
     * dragging a window back and forth between monitors on a multimon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
     * system, or drawing an icon to different Components that have different
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
     * GC's).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
     * So now whenever we create a new icon image for a given GC, we
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1631
     * cache that image with the GC for later retrieval.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1632
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
    static class ImageCacher {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
        // PENDING: Replace this class with CachedPainter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1636
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 453
diff changeset
  1637
        Vector<ImageGcPair> images = new Vector<ImageGcPair>(1, 1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
        ImageGcPair currentImageGcPair;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
        class ImageGcPair {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1641
            Image image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1642
            GraphicsConfiguration gc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
            ImageGcPair(Image image, GraphicsConfiguration gc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
                this.image = image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
                this.gc = gc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1646
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1647
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
            boolean hasSameConfiguration(GraphicsConfiguration newGC) {
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 453
diff changeset
  1649
                return ((newGC != null) && (newGC.equals(gc))) ||
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 453
diff changeset
  1650
                        ((newGC == null) && (gc == null));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1651
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1652
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1653
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
        Image getImage(GraphicsConfiguration newGC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
            if ((currentImageGcPair == null) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1657
                !(currentImageGcPair.hasSameConfiguration(newGC)))
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1658
            {
1290
da8902cd496c 6727661: Code improvement and warnings removing from the swing/plaf packages
rupashka
parents: 453
diff changeset
  1659
                for (ImageGcPair imgGcPair : images) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1660
                    if (imgGcPair.hasSameConfiguration(newGC)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1661
                        currentImageGcPair = imgGcPair;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1662
                        return imgGcPair.image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1664
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1665
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1666
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
            return currentImageGcPair.image;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1669
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1670
        void cacheImage(Image image, GraphicsConfiguration gc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
            ImageGcPair imgGcPair = new ImageGcPair(image, gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
            images.addElement(imgGcPair);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
            currentImageGcPair = imgGcPair;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1674
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1675
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1676
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1680
     * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1681
     * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1682
     * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1683
     * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1684
     * 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: 5506
diff changeset
  1685
     * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
     * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1687
     * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1688
     */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
  1689
    @SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
    public static class FolderIcon16 implements Icon, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1692
        ImageCacher imageCacher;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1693
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
            GraphicsConfiguration gc = c.getGraphicsConfiguration();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
            if (imageCacher == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1697
                imageCacher = new ImageCacher();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1698
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1699
            Image image = imageCacher.getImage(gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1700
            if (image == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1701
                if (gc != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1702
                    image = gc.createCompatibleImage(getIconWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1703
                                                     getIconHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1704
                                                     Transparency.BITMASK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1705
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1706
                    image = new BufferedImage(getIconWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1707
                                              getIconHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1708
                                              BufferedImage.TYPE_INT_ARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1709
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1710
                Graphics imageG = image.getGraphics();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1711
                paintMe(c,imageG);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1712
                imageG.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1713
                imageCacher.cacheImage(image, gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1714
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1715
            g.drawImage(image, x, y+getShift(), null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1717
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1718
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1719
        private void paintMe(Component c, Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1720
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1721
            int right = folderIcon16Size.width - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1722
            int bottom = folderIcon16Size.height - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1723
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1724
            // Draw tab top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1725
            g.setColor( MetalLookAndFeel.getPrimaryControlDarkShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1726
            g.drawLine( right - 5, 3, right, 3 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1727
            g.drawLine( right - 6, 4, right, 4 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1728
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1729
            // Draw folder front
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1730
            g.setColor( MetalLookAndFeel.getPrimaryControl() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1731
            g.fillRect( 2, 7, 13, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1732
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1733
            // Draw tab bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1734
            g.setColor( MetalLookAndFeel.getPrimaryControlShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1735
            g.drawLine( right - 6, 5, right - 1, 5 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1736
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1737
            // Draw outline
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1738
            g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1739
            g.drawLine( 0, 6, 0, bottom );            // left side
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1740
            g.drawLine( 1, 5, right - 7, 5 );         // first part of top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1741
            g.drawLine( right - 6, 6, right - 1, 6 ); // second part of top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1742
            g.drawLine( right, 5, right, bottom );    // right side
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1743
            g.drawLine( 0, bottom, right, bottom );   // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1744
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1745
            // Draw highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1746
            g.setColor( MetalLookAndFeel.getPrimaryControlHighlight() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1747
            g.drawLine( 1, 6, 1, bottom - 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1748
            g.drawLine( 1, 6, right - 7, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1749
            g.drawLine( right - 6, 7, right - 1, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1750
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1751
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1752
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1753
        /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1754
         * Returns a shift of the icon.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1755
         *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1756
         * @return a shift of the icon
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1757
         */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1758
        public int getShift() { return 0; }
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1759
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1760
        /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1761
         * Returns an additional height of the icon.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1762
         *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1763
         * @return an additional height of the icon
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1764
         */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1765
        public int getAdditionalHeight() { return 0; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1766
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1767
        public int getIconWidth() { return folderIcon16Size.width; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1768
        public int getIconHeight() { return folderIcon16Size.height + getAdditionalHeight(); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1769
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1770
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1771
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1772
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1773
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1774
     * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1775
     * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1776
     * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1777
     * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1778
     * 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: 5506
diff changeset
  1779
     * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1780
     * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1781
     * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1782
     */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
  1783
    @SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1784
    public static class TreeFolderIcon extends FolderIcon16 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1785
        public int getShift() { return -1; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1786
        public int getAdditionalHeight() { return 2; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1787
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1788
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1789
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1790
    static private final Dimension fileIcon16Size = new Dimension( 16, 16 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1791
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1792
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1793
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1794
     * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1795
     * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1796
     * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1797
     * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1798
     * 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: 5506
diff changeset
  1799
     * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1800
     * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1801
     * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1802
     */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
  1803
    @SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1804
    public static class FileIcon16 implements Icon, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1805
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1806
        ImageCacher imageCacher;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1807
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1808
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1809
            GraphicsConfiguration gc = c.getGraphicsConfiguration();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1810
            if (imageCacher == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1811
                imageCacher = new ImageCacher();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1812
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1813
            Image image = imageCacher.getImage(gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1814
            if (image == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1815
                if (gc != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1816
                    image = gc.createCompatibleImage(getIconWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1817
                                                     getIconHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1818
                                                     Transparency.BITMASK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1819
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1820
                    image = new BufferedImage(getIconWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1821
                                              getIconHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1822
                                              BufferedImage.TYPE_INT_ARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1823
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1824
                Graphics imageG = image.getGraphics();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1825
                paintMe(c,imageG);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1826
                imageG.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1827
                imageCacher.cacheImage(image, gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1828
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1829
            g.drawImage(image, x, y+getShift(), null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1830
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1831
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1832
        private void paintMe(Component c, Graphics g) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1833
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1834
                int right = fileIcon16Size.width - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1835
                int bottom = fileIcon16Size.height - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1836
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1837
                // Draw fill
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1838
                g.setColor( MetalLookAndFeel.getWindowBackground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1839
                g.fillRect( 4, 2, 9, 12 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1840
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1841
                // Draw frame
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1842
                g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1843
                g.drawLine( 2, 0, 2, bottom );                 // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1844
                g.drawLine( 2, 0, right - 4, 0 );              // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1845
                g.drawLine( 2, bottom, right - 1, bottom );    // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1846
                g.drawLine( right - 1, 6, right - 1, bottom ); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1847
                g.drawLine( right - 6, 2, right - 2, 6 );      // slant 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1848
                g.drawLine( right - 5, 1, right - 4, 1 );      // part of slant 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1849
                g.drawLine( right - 3, 2, right - 3, 3 );      // part of slant 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1850
                g.drawLine( right - 2, 4, right - 2, 5 );      // part of slant 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1851
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1852
                // Draw highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1853
                g.setColor( MetalLookAndFeel.getPrimaryControl() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1854
                g.drawLine( 3, 1, 3, bottom - 1 );                  // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1855
                g.drawLine( 3, 1, right - 6, 1 );                   // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1856
                g.drawLine( right - 2, 7, right - 2, bottom - 1 );  // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1857
                g.drawLine( right - 5, 2, right - 3, 4 );           // slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1858
                g.drawLine( 3, bottom - 1, right - 2, bottom - 1 ); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1859
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1860
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1861
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1862
        /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1863
         * Returns a shift of the icon.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1864
         *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1865
         * @return a shift of the icon
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1866
         */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1867
        public int getShift() { return 0; }
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1868
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1869
        /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1870
         * Returns an additional height of the icon.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1871
         *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1872
         * @return an additional height of the icon
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1873
         */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1874
        public int getAdditionalHeight() { return 0; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1875
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1876
        public int getIconWidth() { return fileIcon16Size.width; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1877
        public int getIconHeight() { return fileIcon16Size.height + getAdditionalHeight(); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1878
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1879
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1880
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1881
    /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1882
     * The class represents a tree leaf icon.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1883
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1884
    public static class TreeLeafIcon extends FileIcon16 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1885
        public int getShift() { return 2; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1886
        public int getAdditionalHeight() { return 4; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1887
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1888
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1889
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1890
    static private final Dimension treeControlSize = new Dimension( 18, 18 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1891
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1892
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1893
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1894
     * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1895
     * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1896
     * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1897
     * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1898
     * 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: 5506
diff changeset
  1899
     * of all JavaBeans&trade;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1900
     * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1901
     * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1902
     */
22574
7f8ce0c8c20a 8032627: Add @SuppressWarnings("serial") to appropriate javax.swing classes
darcy
parents: 20458
diff changeset
  1903
    @SuppressWarnings("serial") // Same-version serialization only
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1904
    public static class TreeControlIcon implements Icon, Serializable {
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1905
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1906
        /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1907
         * if {@code true} the icon is collapsed.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1908
         * NOTE: This data member should not have been exposed. It's called
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1909
         * {@code isLight}, but now it really means {@code isCollapsed}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1910
         * Since we can't change any APIs... that's life.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1911
         */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1912
        protected boolean isLight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1913
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1914
        /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1915
         * Constructs an instance of {@code TreeControlIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1916
         *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1917
         * @param isCollapsed if {@code true} the icon is collapsed
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1918
         */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1919
        public TreeControlIcon( boolean isCollapsed ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1920
            isLight = isCollapsed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1921
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1922
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1923
        ImageCacher imageCacher;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1924
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1925
        transient boolean cachedOrientation = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1926
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1927
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1928
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1929
            GraphicsConfiguration gc = c.getGraphicsConfiguration();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1930
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1931
            if (imageCacher == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1932
                imageCacher = new ImageCacher();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1933
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1934
            Image image = imageCacher.getImage(gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1935
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1936
            if (image == null || cachedOrientation != MetalUtils.isLeftToRight(c)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1937
                cachedOrientation = MetalUtils.isLeftToRight(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1938
                if (gc != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1939
                    image = gc.createCompatibleImage(getIconWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1940
                                                     getIconHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1941
                                                     Transparency.BITMASK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1942
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1943
                    image = new BufferedImage(getIconWidth(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1944
                                              getIconHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1945
                                              BufferedImage.TYPE_INT_ARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1946
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1947
                Graphics imageG = image.getGraphics();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1948
                paintMe(c,imageG,x,y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1949
                imageG.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1950
                imageCacher.cacheImage(image, gc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1951
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1952
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1953
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1954
            if (MetalUtils.isLeftToRight(c)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1955
                if (isLight) {    // isCollapsed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1956
                    g.drawImage(image, x+5, y+3, x+18, y+13,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1957
                                       4,3, 17, 13, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1958
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1959
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1960
                    g.drawImage(image, x+5, y+3, x+18, y+17,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1961
                                       4,3, 17, 17, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1962
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1963
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1964
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1965
                if (isLight) {    // isCollapsed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1966
                    g.drawImage(image, x+3, y+3, x+16, y+13,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1967
                                       4, 3, 17, 13, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1968
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1969
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1970
                    g.drawImage(image, x+3, y+3, x+16, y+17,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1971
                                       4, 3, 17, 17, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1972
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1973
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1974
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1975
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1976
        /**
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1977
         * Paints the {@code TreeControlIcon}.
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1978
         *
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1979
         * @param c a component
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1980
         * @param g an instance of {@code Graphics}
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1981
         * @param x an X coordinate
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1982
         * @param y an Y coordinate
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1983
         */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1984
        public void paintMe(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1985
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1986
            g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1987
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1988
            int xoff = (MetalUtils.isLeftToRight(c)) ? 0 : 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1989
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1990
            // Draw circle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1991
            g.drawLine( xoff + 4, 6, xoff + 4, 9 );     // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1992
            g.drawLine( xoff + 5, 5, xoff + 5, 5 );     // top left dot
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1993
            g.drawLine( xoff + 6, 4, xoff + 9, 4 );     // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1994
            g.drawLine( xoff + 10, 5, xoff + 10, 5 );   // top right dot
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1995
            g.drawLine( xoff + 11, 6, xoff + 11, 9 );   // right
25178
dbab904451e9 8046434: Fix doclint warnings from javax.swing.plaf.metal package
yan
parents: 25095
diff changeset
  1996
            g.drawLine( xoff + 10, 10, xoff + 10, 10 ); // bottom right dot
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1997
            g.drawLine( xoff + 6, 11, xoff + 9, 11 );   // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1998
            g.drawLine( xoff + 5, 10, xoff + 5, 10 );   // bottom left dot
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1999
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2000
            // Draw Center Dot
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2001
            g.drawLine( xoff + 7, 7, xoff + 8, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2002
            g.drawLine( xoff + 7, 8, xoff + 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2003
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2004
            // Draw Handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2005
            if ( isLight ) {    // isCollapsed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2006
                if( MetalUtils.isLeftToRight(c) ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2007
                    g.drawLine( 12, 7, 15, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2008
                    g.drawLine( 12, 8, 15, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2009
                    //  g.setColor( c.getBackground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2010
                    //  g.drawLine( 16, 7, 16, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2011
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2012
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2013
                    g.drawLine(4, 7, 7, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2014
                    g.drawLine(4, 8, 7, 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2015
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2016
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2017
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2018
                g.drawLine( xoff + 7, 12, xoff + 7, 15 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2019
                g.drawLine( xoff + 8, 12, xoff + 8, 15 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2020
                //      g.setColor( c.getBackground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2021
                //      g.drawLine( xoff + 7, 16, xoff + 8, 16 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2022
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2023
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2024
            // Draw Fill
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2025
            g.setColor( MetalLookAndFeel.getPrimaryControlDarkShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2026
            g.drawLine( xoff + 5, 6, xoff + 5, 9 );      // left shadow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2027
            g.drawLine( xoff + 6, 5, xoff + 9, 5 );      // top shadow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2028
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2029
            g.setColor( MetalLookAndFeel.getPrimaryControlShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2030
            g.drawLine( xoff + 6, 6, xoff + 6, 6 );      // top left fill
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2031
            g.drawLine( xoff + 9, 6, xoff + 9, 6 );      // top right fill
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2032
            g.drawLine( xoff + 6, 9, xoff + 6, 9 );      // bottom left fill
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2033
            g.drawLine( xoff + 10, 6, xoff + 10, 9 );    // right fill
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2034
            g.drawLine( xoff + 6, 10, xoff + 9, 10 );    // bottom fill
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2035
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2036
            g.setColor( MetalLookAndFeel.getPrimaryControl() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2037
            g.drawLine( xoff + 6, 7, xoff + 6, 8 );      // left highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2038
            g.drawLine( xoff + 7, 6, xoff + 8, 6 );      // top highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2039
            g.drawLine( xoff + 9, 7, xoff + 9, 7 );      // right highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2040
            g.drawLine( xoff + 7, 9, xoff + 7, 9 );      // bottom highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2041
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2042
            g.setColor( MetalLookAndFeel.getPrimaryControlHighlight() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2043
            g.drawLine( xoff + 8, 9, xoff + 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2044
            g.drawLine( xoff + 9, 8, xoff + 9, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2045
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2046
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2047
        public int getIconWidth() { return treeControlSize.width; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2048
        public int getIconHeight() { return treeControlSize.height; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2049
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2050
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2051
  //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2052
  // Menu Icons
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2053
  //
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2054
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2055
    static private final Dimension menuArrowIconSize = new Dimension( 4, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2056
    static private final Dimension menuCheckIconSize = new Dimension( 10, 10 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2057
    static private final int xOff = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2058
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2059
    private static class MenuArrowIcon implements Icon, UIResource, Serializable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2060
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2061
        public void paintIcon( Component c, Graphics g, int x, int y )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2062
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2063
            JMenuItem b = (JMenuItem) c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2064
            ButtonModel model = b.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2065
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2066
            g.translate( x, y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2067
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2068
            if ( !model.isEnabled() )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2069
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2070
                g.setColor( MetalLookAndFeel.getMenuDisabledForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2071
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2072
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2073
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2074
                if ( model.isArmed() || ( c instanceof JMenu && model.isSelected() ) )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2075
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2076
                    g.setColor( MetalLookAndFeel.getMenuSelectedForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2077
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2078
                else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2079
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2080
                    g.setColor( b.getForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2081
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2082
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2083
            if( MetalUtils.isLeftToRight(b) ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2084
                g.drawLine( 0, 0, 0, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2085
                g.drawLine( 1, 1, 1, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2086
                g.drawLine( 2, 2, 2, 5 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2087
                g.drawLine( 3, 3, 3, 4 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2088
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2089
                g.drawLine( 4, 0, 4, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2090
                g.drawLine( 3, 1, 3, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2091
                g.drawLine( 2, 2, 2, 5 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2092
                g.drawLine( 1, 3, 1, 4 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2093
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2094
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2095
            g.translate( -x, -y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2096
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2097
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2098
        public int getIconWidth() { return menuArrowIconSize.width; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2099
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2100
        public int getIconHeight() { return menuArrowIconSize.height; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2102
    } // End class MenuArrowIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2103
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2104
    private static class MenuItemArrowIcon implements Icon, UIResource, Serializable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2105
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2106
        public void paintIcon( Component c, Graphics g, int x, int y )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2107
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2108
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2109
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2110
        public int getIconWidth() { return menuArrowIconSize.width; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2111
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2112
        public int getIconHeight() { return menuArrowIconSize.height; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2113
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2114
    } // End class MenuItemArrowIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2115
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2116
    private static class CheckBoxMenuItemIcon implements Icon, UIResource, Serializable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2117
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2118
        public void paintOceanIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2119
            ButtonModel model = ((JMenuItem)c).getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2120
            boolean isSelected = model.isSelected();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2121
            boolean isEnabled = model.isEnabled();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2122
            boolean isPressed = model.isPressed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2123
            boolean isArmed = model.isArmed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2124
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2125
            g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2126
            if (isEnabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2127
                MetalUtils.drawGradient(c, g, "CheckBoxMenuItem.gradient",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2128
                                        1, 1, 7, 7, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2129
                if (isPressed || isArmed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2130
                    g.setColor(MetalLookAndFeel.getControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2131
                    g.drawLine( 0, 0, 8, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2132
                    g.drawLine( 0, 0, 0, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2133
                    g.drawLine( 8, 2, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2134
                    g.drawLine( 2, 8, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2135
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2136
                    g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2137
                    g.drawLine( 9, 1, 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2138
                    g.drawLine( 1, 9, 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2139
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2140
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2141
                    g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2142
                    g.drawLine( 0, 0, 8, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2143
                    g.drawLine( 0, 0, 0, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2144
                    g.drawLine( 8, 2, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2145
                    g.drawLine( 2, 8, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2146
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2147
                    g.setColor(MetalLookAndFeel.getControlHighlight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2148
                    g.drawLine( 9, 1, 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2149
                    g.drawLine( 1, 9, 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2150
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2151
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2152
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2153
                g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2154
                g.drawRect( 0, 0, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2155
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2156
            if (isSelected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2157
                if (isEnabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2158
                    if (isArmed || ( c instanceof JMenu && isSelected)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2159
                        g.setColor(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2160
                            MetalLookAndFeel.getMenuSelectedForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2161
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2162
                    else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2163
                         g.setColor(MetalLookAndFeel.getControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2164
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2165
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2166
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2167
                    g.setColor( MetalLookAndFeel.getMenuDisabledForeground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2168
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2169
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2170
                g.drawLine( 2, 2, 2, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2171
                g.drawLine( 3, 2, 3, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2172
                g.drawLine( 4, 4, 8, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2173
                g.drawLine( 4, 5, 9, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2174
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2175
            g.translate( -x, -y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2176
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2177
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2178
        public void paintIcon( Component c, Graphics g, int x, int y )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2179
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2180
            if (MetalLookAndFeel.usingOcean()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2181
                paintOceanIcon(c, g, x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2182
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2183
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2184
            JMenuItem b = (JMenuItem) c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2185
            ButtonModel model = b.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2186
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2187
            boolean isSelected = model.isSelected();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2188
            boolean isEnabled = model.isEnabled();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2189
            boolean isPressed = model.isPressed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2190
            boolean isArmed = model.isArmed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2191
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2192
            g.translate( x, y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2193
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2194
            if ( isEnabled )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2195
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2196
                if ( isPressed || isArmed )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2197
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2198
                    g.setColor( MetalLookAndFeel.getControlInfo()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2199
                    g.drawLine( 0, 0, 8, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2200
                    g.drawLine( 0, 0, 0, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2201
                    g.drawLine( 8, 2, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2202
                    g.drawLine( 2, 8, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2203
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2204
                    g.setColor( MetalLookAndFeel.getPrimaryControl()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2205
                    g.drawLine( 1, 1, 7, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2206
                    g.drawLine( 1, 1, 1, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2207
                    g.drawLine( 9, 1, 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2208
                    g.drawLine( 1, 9, 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2209
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2210
                else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2211
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2212
                    g.setColor( MetalLookAndFeel.getControlDarkShadow()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2213
                    g.drawLine( 0, 0, 8, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2214
                    g.drawLine( 0, 0, 0, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2215
                    g.drawLine( 8, 2, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2216
                    g.drawLine( 2, 8, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2217
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2218
                    g.setColor( MetalLookAndFeel.getControlHighlight()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2219
                    g.drawLine( 1, 1, 7, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2220
                    g.drawLine( 1, 1, 1, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2221
                    g.drawLine( 9, 1, 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2222
                    g.drawLine( 1, 9, 9, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2223
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2224
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2225
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2226
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2227
                g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2228
                g.drawRect( 0, 0, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2229
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2230
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2231
            if ( isSelected )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2232
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2233
                if ( isEnabled )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2234
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2235
                    if ( model.isArmed() || ( c instanceof JMenu && model.isSelected() ) )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2236
                    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2237
                        g.setColor( MetalLookAndFeel.getMenuSelectedForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2238
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2239
                    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2240
                    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2241
                        g.setColor( b.getForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2242
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2243
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2244
                else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2245
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2246
                    g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2247
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2248
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2249
                g.drawLine( 2, 2, 2, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2250
                g.drawLine( 3, 2, 3, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2251
                g.drawLine( 4, 4, 8, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2252
                g.drawLine( 4, 5, 9, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2253
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2254
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2255
            g.translate( -x, -y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2256
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2257
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2258
        public int getIconWidth() { return menuCheckIconSize.width; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2259
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2260
        public int getIconHeight() { return menuCheckIconSize.height; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2261
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2262
    }  // End class CheckBoxMenuItemIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2263
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2264
    private static class RadioButtonMenuItemIcon implements Icon, UIResource, Serializable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2265
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2266
        public void paintOceanIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2267
            ButtonModel model = ((JMenuItem)c).getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2268
            boolean isSelected = model.isSelected();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2269
            boolean isEnabled = model.isEnabled();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2270
            boolean isPressed = model.isPressed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2271
            boolean isArmed = model.isArmed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2272
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2273
            g.translate( x, y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2274
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2275
            if (isEnabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2276
                MetalUtils.drawGradient(c, g, "RadioButtonMenuItem.gradient",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2277
                                        1, 1, 7, 7, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2278
                if (isPressed || isArmed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2279
                    g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2280
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2281
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2282
                    g.setColor(MetalLookAndFeel.getControlHighlight());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2283
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2284
                g.drawLine( 2, 9, 7, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2285
                g.drawLine( 9, 2, 9, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2286
                g.drawLine( 8, 8, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2287
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2288
                if (isPressed || isArmed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2289
                    g.setColor(MetalLookAndFeel.getControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2290
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2291
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2292
                    g.setColor(MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2293
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2294
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2295
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2296
                g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2297
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2298
            g.drawLine( 2, 0, 6, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2299
            g.drawLine( 2, 8, 6, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2300
            g.drawLine( 0, 2, 0, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2301
            g.drawLine( 8, 2, 8, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2302
            g.drawLine( 1, 1, 1, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2303
            g.drawLine( 7, 1, 7, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2304
            g.drawLine( 1, 7, 1, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2305
            g.drawLine( 7, 7, 7, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2306
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2307
            if (isSelected) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2308
                if (isEnabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2309
                    if (isArmed || (c instanceof JMenu && model.isSelected())){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2310
                        g.setColor(MetalLookAndFeel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2311
                                   getMenuSelectedForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2312
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2313
                    else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2314
                        g.setColor(MetalLookAndFeel.getControlInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2315
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2316
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2317
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2318
                    g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2319
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2320
                g.drawLine( 3, 2, 5, 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2321
                g.drawLine( 2, 3, 6, 3 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2322
                g.drawLine( 2, 4, 6, 4 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2323
                g.drawLine( 2, 5, 6, 5 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2324
                g.drawLine( 3, 6, 5, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2325
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2326
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2327
            g.translate( -x, -y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2328
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2329
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2330
        public void paintIcon( Component c, Graphics g, int x, int y )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2331
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2332
            if (MetalLookAndFeel.usingOcean()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2333
                paintOceanIcon(c, g, x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2334
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2335
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2336
            JMenuItem b = (JMenuItem) c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2337
            ButtonModel model = b.getModel();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2338
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2339
            boolean isSelected = model.isSelected();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2340
            boolean isEnabled = model.isEnabled();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2341
            boolean isPressed = model.isPressed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2342
            boolean isArmed = model.isArmed();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2343
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2344
            g.translate( x, y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2345
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2346
            if ( isEnabled )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2347
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2348
                if ( isPressed || isArmed )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2349
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2350
                    g.setColor( MetalLookAndFeel.getPrimaryControl()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2351
                    g.drawLine( 3, 1, 8, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2352
                    g.drawLine( 2, 9, 7, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2353
                    g.drawLine( 1, 3, 1, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2354
                    g.drawLine( 9, 2, 9, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2355
                    g.drawLine( 2, 2, 2, 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2356
                    g.drawLine( 8, 8, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2357
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2358
                    g.setColor( MetalLookAndFeel.getControlInfo()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2359
                    g.drawLine( 2, 0, 6, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2360
                    g.drawLine( 2, 8, 6, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2361
                    g.drawLine( 0, 2, 0, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2362
                    g.drawLine( 8, 2, 8, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2363
                    g.drawLine( 1, 1, 1, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2364
                    g.drawLine( 7, 1, 7, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2365
                    g.drawLine( 1, 7, 1, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2366
                    g.drawLine( 7, 7, 7, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2367
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2368
                else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2369
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2370
                    g.setColor( MetalLookAndFeel.getControlHighlight()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2371
                    g.drawLine( 3, 1, 8, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2372
                    g.drawLine( 2, 9, 7, 9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2373
                    g.drawLine( 1, 3, 1, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2374
                    g.drawLine( 9, 2, 9, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2375
                    g.drawLine( 2, 2, 2, 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2376
                    g.drawLine( 8, 8, 8, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2377
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2378
                    g.setColor( MetalLookAndFeel.getControlDarkShadow()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2379
                    g.drawLine( 2, 0, 6, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2380
                    g.drawLine( 2, 8, 6, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2381
                    g.drawLine( 0, 2, 0, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2382
                    g.drawLine( 8, 2, 8, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2383
                    g.drawLine( 1, 1, 1, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2384
                    g.drawLine( 7, 1, 7, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2385
                    g.drawLine( 1, 7, 1, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2386
                    g.drawLine( 7, 7, 7, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2387
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2388
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2389
            else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2390
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2391
                g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2392
                g.drawLine( 2, 0, 6, 0 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2393
                g.drawLine( 2, 8, 6, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2394
                g.drawLine( 0, 2, 0, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2395
                g.drawLine( 8, 2, 8, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2396
                g.drawLine( 1, 1, 1, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2397
                g.drawLine( 7, 1, 7, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2398
                g.drawLine( 1, 7, 1, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2399
                g.drawLine( 7, 7, 7, 7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2400
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2401
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2402
            if ( isSelected )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2403
            {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2404
                if ( isEnabled )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2405
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2406
                    if ( model.isArmed() || ( c instanceof JMenu && model.isSelected() ) )
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2407
                    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2408
                        g.setColor( MetalLookAndFeel.getMenuSelectedForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2409
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2410
                    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2411
                    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2412
                        g.setColor( b.getForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2413
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2414
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2415
                else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2416
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2417
                    g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2418
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2419
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2420
                g.drawLine( 3, 2, 5, 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2421
                g.drawLine( 2, 3, 6, 3 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2422
                g.drawLine( 2, 4, 6, 4 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2423
                g.drawLine( 2, 5, 6, 5 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2424
                g.drawLine( 3, 6, 5, 6 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2425
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2426
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2427
            g.translate( -x, -y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2428
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2429
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2430
        public int getIconWidth() { return menuCheckIconSize.width; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2431
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2432
        public int getIconHeight() { return menuCheckIconSize.height; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2433
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2434
    }  // End class RadioButtonMenuItemIcon
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2435
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2436
private static class VerticalSliderThumbIcon implements Icon, Serializable, UIResource {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2437
    protected static MetalBumps controlBumps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2438
    protected static MetalBumps primaryBumps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2439
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2440
    public VerticalSliderThumbIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2441
        controlBumps = new MetalBumps( 6, 10,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2442
                                MetalLookAndFeel.getControlHighlight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2443
                                MetalLookAndFeel.getControlInfo(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2444
                                MetalLookAndFeel.getControl() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2445
        primaryBumps = new MetalBumps( 6, 10,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2446
                                MetalLookAndFeel.getPrimaryControl(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2447
                                MetalLookAndFeel.getPrimaryControlDarkShadow(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2448
                                MetalLookAndFeel.getPrimaryControlShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2449
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2450
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2451
    public void paintIcon( Component c, Graphics g, int x, int y ) {
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2452
        boolean leftToRight = MetalUtils.isLeftToRight(c);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2453
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2454
        g.translate( x, y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2455
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2456
        // Draw the frame
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2457
        if ( c.hasFocus() ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2458
            g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2459
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2460
        else {
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2461
            g.setColor( c.isEnabled() ? MetalLookAndFeel.getPrimaryControlInfo() :
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2462
                                             MetalLookAndFeel.getControlDarkShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2463
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2464
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2465
        if (leftToRight) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2466
            g.drawLine(  1,0  ,  8,0  ); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2467
            g.drawLine(  0,1  ,  0,13 ); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2468
            g.drawLine(  1,14 ,  8,14 ); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2469
            g.drawLine(  9,1  , 15,7  ); // top slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2470
            g.drawLine(  9,13 , 15,7  ); // bottom slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2471
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2472
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2473
            g.drawLine(  7,0  , 14,0  ); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2474
            g.drawLine( 15,1  , 15,13 ); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2475
            g.drawLine(  7,14 , 14,14 ); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2476
            g.drawLine(  0,7  ,  6,1  ); // top slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2477
            g.drawLine(  0,7  ,  6,13 ); // bottom slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2478
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2479
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2480
        // Fill in the background
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2481
        if ( c.hasFocus() ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2482
            g.setColor( c.getForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2483
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2484
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2485
            g.setColor( MetalLookAndFeel.getControl() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2486
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2487
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2488
        if (leftToRight) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2489
            g.fillRect(  1,1 ,  8,13 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2490
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2491
            g.drawLine(  9,2 ,  9,12 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2492
            g.drawLine( 10,3 , 10,11 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2493
            g.drawLine( 11,4 , 11,10 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2494
            g.drawLine( 12,5 , 12,9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2495
            g.drawLine( 13,6 , 13,8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2496
            g.drawLine( 14,7 , 14,7 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2497
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2498
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2499
            g.fillRect(  7,1,   8,13 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2500
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2501
            g.drawLine(  6,3 ,  6,12 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2502
            g.drawLine(  5,4 ,  5,11 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2503
            g.drawLine(  4,5 ,  4,10 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2504
            g.drawLine(  3,6 ,  3,9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2505
            g.drawLine(  2,7 ,  2,8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2506
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2507
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2508
        // Draw the bumps
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2509
        int offset = (leftToRight) ? 2 : 8;
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2510
        if ( c.isEnabled() ) {
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2511
            if ( c.hasFocus() ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2512
                primaryBumps.paintIcon( c, g, offset, 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2513
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2514
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2515
                controlBumps.paintIcon( c, g, offset, 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2516
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2517
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2518
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2519
        // Draw the highlight
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2520
        if ( c.isEnabled() ) {
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2521
            g.setColor( c.hasFocus() ? MetalLookAndFeel.getPrimaryControl()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2522
                        : MetalLookAndFeel.getControlHighlight() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2523
            if (leftToRight) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2524
                g.drawLine( 1, 1, 8, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2525
                g.drawLine( 1, 1, 1, 13 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2526
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2527
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2528
                g.drawLine(  8,1  , 14,1  ); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2529
                g.drawLine(  1,7  ,  7,1  ); // top slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2530
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2531
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2532
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2533
        g.translate( -x, -y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2534
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2535
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2536
    public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2537
        return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2538
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2539
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2540
    public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2541
        return 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2542
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2543
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2544
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2545
private static class HorizontalSliderThumbIcon implements Icon, Serializable, UIResource {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2546
    protected static MetalBumps controlBumps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2547
    protected static MetalBumps primaryBumps;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2548
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2549
    public HorizontalSliderThumbIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2550
        controlBumps = new MetalBumps( 10, 6,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2551
                                MetalLookAndFeel.getControlHighlight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2552
                                MetalLookAndFeel.getControlInfo(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2553
                                MetalLookAndFeel.getControl() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2554
        primaryBumps = new MetalBumps( 10, 6,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2555
                                MetalLookAndFeel.getPrimaryControl(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2556
                                MetalLookAndFeel.getPrimaryControlDarkShadow(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2557
                                MetalLookAndFeel.getPrimaryControlShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2558
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2559
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2560
    public void paintIcon( Component c, Graphics g, int x, int y ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2561
        g.translate( x, y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2562
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2563
        // Draw the frame
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2564
        if ( c.hasFocus() ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2565
            g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2566
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2567
        else {
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2568
            g.setColor( c.isEnabled() ? MetalLookAndFeel.getPrimaryControlInfo() :
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2569
                                             MetalLookAndFeel.getControlDarkShadow() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2570
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2571
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2572
        g.drawLine(  1,0  , 13,0 );  // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2573
        g.drawLine(  0,1  ,  0,8 );  // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2574
        g.drawLine( 14,1  , 14,8 );  // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2575
        g.drawLine(  1,9  ,  7,15 ); // left slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2576
        g.drawLine(  7,15 , 14,8 );  // right slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2577
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2578
        // Fill in the background
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2579
        if ( c.hasFocus() ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2580
            g.setColor( c.getForeground() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2581
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2582
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2583
            g.setColor( MetalLookAndFeel.getControl() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2584
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2585
        g.fillRect( 1,1, 13, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2586
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2587
        g.drawLine( 2,9  , 12,9 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2588
        g.drawLine( 3,10 , 11,10 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2589
        g.drawLine( 4,11 , 10,11 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2590
        g.drawLine( 5,12 ,  9,12 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2591
        g.drawLine( 6,13 ,  8,13 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2592
        g.drawLine( 7,14 ,  7,14 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2593
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2594
        // Draw the bumps
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2595
        if ( c.isEnabled() ) {
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2596
            if ( c.hasFocus() ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2597
                primaryBumps.paintIcon( c, g, 2, 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2598
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2599
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2600
                controlBumps.paintIcon( c, g, 2, 2 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2601
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2602
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2603
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2604
        // Draw the highlight
453
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2605
        if ( c.isEnabled() ) {
145f4ac00bfd 4252173: Inability to reuse the HorizontalSliderThumbIcon
rupashka
parents: 2
diff changeset
  2606
            g.setColor( c.hasFocus() ? MetalLookAndFeel.getPrimaryControl()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2607
                        : MetalLookAndFeel.getControlHighlight() );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2608
            g.drawLine( 1, 1, 13, 1 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2609
            g.drawLine( 1, 1, 1, 8 );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2610
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2611
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2612
        g.translate( -x, -y );
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2613
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2614
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2615
    public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2616
        return 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2617
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2618
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2619
    public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2620
        return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2621
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2622
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2623
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2624
    private static class OceanVerticalSliderThumbIcon extends CachedPainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2625
                              implements Icon, Serializable, UIResource {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2626
        // Used for clipping when the orientation is left to right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2627
        private static Polygon LTR_THUMB_SHAPE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2628
        // Used for clipping when the orientation is right to left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2629
        private static Polygon RTL_THUMB_SHAPE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2630
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2631
        static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2632
            LTR_THUMB_SHAPE = new Polygon(new int[] { 0,  8, 15,  8,  0},
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2633
                                          new int[] { 0,  0,  7, 14, 14 }, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2634
            RTL_THUMB_SHAPE = new Polygon(new int[] { 15, 15,  7,  0,  7},
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2635
                                          new int[] {  0, 14, 14,  7,  0}, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2636
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2637
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2638
        OceanVerticalSliderThumbIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2639
            super(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2640
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2641
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2642
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2643
            if (!(g instanceof Graphics2D)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2644
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2645
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2646
            paint(c, g, x, y, getIconWidth(), getIconHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2647
                  MetalUtils.isLeftToRight(c), c.hasFocus(), c.isEnabled(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2648
                  MetalLookAndFeel.getCurrentTheme());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2649
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2650
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2651
        protected void paintToImage(Component c, Image image, Graphics g2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2652
                                    int w, int h, Object[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2653
            Graphics2D g = (Graphics2D)g2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2654
            boolean leftToRight = ((Boolean)args[0]).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2655
            boolean hasFocus = ((Boolean)args[1]).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2656
            boolean enabled = ((Boolean)args[2]).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2657
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2658
            Rectangle clip = g.getClipBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2659
            if (leftToRight) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2660
                g.clip(LTR_THUMB_SHAPE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2661
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2662
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2663
                g.clip(RTL_THUMB_SHAPE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2664
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2665
            if (!enabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2666
                g.setColor(MetalLookAndFeel.getControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2667
                g.fillRect(1, 1, 14, 14);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2668
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2669
            else if (hasFocus) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2670
                MetalUtils.drawGradient(c, g, "Slider.focusGradient",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2671
                                        1, 1, 14, 14, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2672
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2673
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2674
                MetalUtils.drawGradient(c, g, "Slider.gradient",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2675
                                        1, 1, 14, 14, false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2676
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2677
            g.setClip(clip);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2678
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2679
            // Draw the frame
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2680
            if (hasFocus) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2681
                g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2682
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2683
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2684
                g.setColor(enabled ? MetalLookAndFeel.getPrimaryControlInfo() :
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2685
                           MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2686
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2687
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2688
            if (leftToRight) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2689
                g.drawLine(  1,0  ,  8,0  ); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2690
                g.drawLine(  0,1  ,  0,13 ); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2691
                g.drawLine(  1,14 ,  8,14 ); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2692
                g.drawLine(  9,1  , 15,7  ); // top slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2693
                g.drawLine(  9,13 , 15,7  ); // bottom slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2694
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2695
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2696
                g.drawLine(  7,0  , 14,0  ); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2697
                g.drawLine( 15,1  , 15,13 ); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2698
                g.drawLine(  7,14 , 14,14 ); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2699
                g.drawLine(  0,7  ,  6,1  ); // top slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2700
                g.drawLine(  0,7  ,  6,13 ); // bottom slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2701
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2702
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2703
            if (hasFocus && enabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2704
                // Inner line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2705
                g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2706
                if (leftToRight) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2707
                    g.drawLine(  1,1  ,  8,1  ); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2708
                    g.drawLine(  1,1  ,  1,13 ); // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2709
                    g.drawLine(  1,13 ,  8,13 ); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2710
                    g.drawLine(  9,2  , 14,7  ); // top slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2711
                    g.drawLine(  9,12 , 14,7  ); // bottom slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2712
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2713
                else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2714
                    g.drawLine(  7,1  , 14,1  ); // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2715
                    g.drawLine( 14,1  , 14,13 ); // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2716
                    g.drawLine(  7,13 , 14,13 ); // bottom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2717
                    g.drawLine(  1,7  ,  7,1  ); // top slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2718
                    g.drawLine(  1,7  ,  7,13 ); // bottom slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2719
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2720
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2721
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2722
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2723
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2724
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2725
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2726
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2727
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2728
            return 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2729
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2730
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2731
        protected Image createImage(Component c, int w, int h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2732
                                    GraphicsConfiguration config,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2733
                                    Object[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2734
            if (config == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2735
                return new BufferedImage(w, h,BufferedImage.TYPE_INT_ARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2736
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2737
            return config.createCompatibleImage(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2738
                                w, h, Transparency.BITMASK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2739
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2740
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2741
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2742
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2743
    private static class OceanHorizontalSliderThumbIcon extends CachedPainter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2744
                              implements Icon, Serializable, UIResource {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2745
        // Used for clipping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2746
        private static Polygon THUMB_SHAPE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2747
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2748
        static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2749
            THUMB_SHAPE = new Polygon(new int[] { 0, 14, 14,  7,  0 },
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2750
                                      new int[] { 0,  0,  8, 15,  8 }, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2751
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2752
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2753
        OceanHorizontalSliderThumbIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2754
            super(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2755
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2756
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2757
        public void paintIcon(Component c, Graphics g, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2758
            if (!(g instanceof Graphics2D)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2759
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2760
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2761
            paint(c, g, x, y, getIconWidth(), getIconHeight(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2762
                  c.hasFocus(), c.isEnabled(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2763
                  MetalLookAndFeel.getCurrentTheme());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2764
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2765
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2766
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2767
        protected Image createImage(Component c, int w, int h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2768
                                    GraphicsConfiguration config,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2769
                                    Object[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2770
            if (config == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2771
                return new BufferedImage(w, h,BufferedImage.TYPE_INT_ARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2772
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2773
            return config.createCompatibleImage(
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2774
                                w, h, Transparency.BITMASK);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2775
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2776
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2777
        protected void paintToImage(Component c, Image image, Graphics g2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2778
                                    int w, int h, Object[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2779
            Graphics2D g = (Graphics2D)g2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2780
            boolean hasFocus = ((Boolean)args[0]).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2781
            boolean enabled = ((Boolean)args[1]).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2782
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2783
            // Fill in the background
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2784
            Rectangle clip = g.getClipBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2785
            g.clip(THUMB_SHAPE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2786
            if (!enabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2787
                g.setColor(MetalLookAndFeel.getControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2788
                g.fillRect(1, 1, 13, 14);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2789
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2790
            else if (hasFocus) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2791
                MetalUtils.drawGradient(c, g, "Slider.focusGradient",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2792
                                        1, 1, 13, 14, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2793
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2794
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2795
                MetalUtils.drawGradient(c, g, "Slider.gradient",
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2796
                                        1, 1, 13, 14, true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2797
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2798
            g.setClip(clip);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2799
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2800
            // Draw the frame
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2801
            if (hasFocus) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2802
                g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2803
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2804
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2805
                g.setColor(enabled ? MetalLookAndFeel.getPrimaryControlInfo() :
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2806
                           MetalLookAndFeel.getControlDarkShadow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2807
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2808
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2809
            g.drawLine(  1,0  , 13,0 );  // top
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2810
            g.drawLine(  0,1  ,  0,8 );  // left
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2811
            g.drawLine( 14,1  , 14,8 );  // right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2812
            g.drawLine(  1,9  ,  7,15 ); // left slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2813
            g.drawLine(  7,15 , 14,8 );  // right slant
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2814
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2815
            if (hasFocus && enabled) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2816
                // Inner line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2817
                g.setColor(MetalLookAndFeel.getPrimaryControl());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2818
                g.fillRect(1, 1, 13, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2819
                g.fillRect(1, 2, 1, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2820
                g.fillRect(13, 2, 1, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2821
                g.drawLine(2, 9, 7, 14);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2822
                g.drawLine(8, 13, 12, 9);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2823
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2824
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2825
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2826
        public int getIconWidth() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2827
            return 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2828
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2829
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2830
        public int getIconHeight() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2831
            return 16;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2832
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2833
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2834
}