jdk/src/share/classes/javax/swing/border/MatteBorder.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
child 5597 ab490f66d2cf
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.swing.border;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.Graphics;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Insets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.Rectangle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.Component;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.Color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import javax.swing.Icon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * A class which provides a matte-like border of either a solid color
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * or a tiled icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <strong>Warning:</strong>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * Serialized objects of this class will not be compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * future Swing releases. The current serialization support is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * appropriate for short term storage or RMI between applications running
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * the same version of Swing.  As of 1.4, support for long term storage
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * of all JavaBeans<sup><font size="-2">TM</font></sup>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * has been added to the <code>java.beans</code> package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * Please see {@link java.beans.XMLEncoder}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * @author Amy Fowler
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
public class MatteBorder extends EmptyBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    protected Color color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    protected Icon tileIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * Creates a matte border with the specified insets and color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * @param top the top inset of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * @param left the left inset of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * @param bottom the bottom inset of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @param right the right inset of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * @param matteColor the color rendered for the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    public MatteBorder(int top, int left, int bottom, int right, Color matteColor)   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        super(top, left, bottom, right);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        this.color = matteColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Creates a matte border with the specified insets and color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @param borderInsets the insets of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * @param matteColor the color rendered for the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    public MatteBorder(Insets borderInsets, Color matteColor)   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        super(borderInsets);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        this.color = matteColor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * Creates a matte border with the specified insets and tile icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @param top the top inset of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @param left the left inset of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * @param bottom the bottom inset of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @param right the right inset of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @param tileIcon the icon to be used for tiling the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public MatteBorder(int top, int left, int bottom, int right, Icon tileIcon)   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        super(top, left, bottom, right);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        this.tileIcon = tileIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * Creates a matte border with the specified insets and tile icon.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @param borderInsets the insets of the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * @param tileIcon the icon to be used for tiling the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public MatteBorder(Insets borderInsets, Icon tileIcon)   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        super(borderInsets);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        this.tileIcon = tileIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * Creates a matte border with the specified tile icon.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * insets will be calculated dynamically based on the size of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * the tile icon, where the top and bottom will be equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * tile icon's height, and the left and right will be equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * the tile icon's width.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @param tileIcon the icon to be used for tiling the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public MatteBorder(Icon tileIcon)   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        this(-1,-1,-1,-1, tileIcon);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Paints the matte border.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        Insets insets = getBorderInsets(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        Color oldColor = g.getColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        // If the tileIcon failed loading, paint as gray.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        if (tileIcon != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            color = (tileIcon.getIconWidth() == -1) ? Color.gray : null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        if (color != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            g.setColor(color);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            g.fillRect(0, 0, width - insets.right, insets.top);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            g.fillRect(0, insets.top, insets.left, height - insets.top);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            g.fillRect(insets.left, height - insets.bottom, width - insets.left, insets.bottom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            g.fillRect(width - insets.right, 0, insets.right, height - insets.bottom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        } else if (tileIcon != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            int tileW = tileIcon.getIconWidth();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            int tileH = tileIcon.getIconHeight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            int xpos, ypos, startx, starty;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            Graphics cg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            // Paint top matte edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            cg = g.create();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            cg.setClip(0, 0, width, insets.top);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            for (ypos = 0; insets.top - ypos > 0; ypos += tileH) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                for (xpos = 0; width - xpos > 0; xpos += tileW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                    tileIcon.paintIcon(c, cg, xpos, ypos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            cg.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            // Paint left matte edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            cg = g.create();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            cg.setClip(0, insets.top, insets.left, height - insets.top);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            starty = insets.top - (insets.top%tileH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            startx = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            for (ypos = starty; height - ypos > 0; ypos += tileH) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                for (xpos = startx; insets.left - xpos > 0; xpos += tileW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                    tileIcon.paintIcon(c, cg, xpos, ypos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            cg.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            // Paint bottom matte edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            cg = g.create();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            cg.setClip(insets.left, height - insets.bottom, width - insets.left, insets.bottom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            starty = (height - insets.bottom) - ((height - insets.bottom)%tileH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            startx = insets.left - (insets.left%tileW);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            for (ypos = starty; height - ypos > 0; ypos += tileH) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                for (xpos = startx; width - xpos > 0; xpos += tileW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                    tileIcon.paintIcon(c, cg, xpos, ypos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            cg.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            // Paint right matte edge
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            cg = g.create();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            cg.setClip(width - insets.right, insets.top, insets.right, height - insets.top - insets.bottom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            starty = insets.top - (insets.top%tileH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            startx = width - insets.right - ((width - insets.right)%tileW);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            for (ypos = starty; height - ypos > 0; ypos += tileH) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                for (xpos = startx; width - xpos > 0; xpos += tileW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                    tileIcon.paintIcon(c, cg, xpos, ypos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            cg.dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        g.translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        g.setColor(oldColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * Reinitialize the insets parameter with this Border's current Insets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @param c the component for which this border insets value applies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @param insets the object to be reinitialized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    public Insets getBorderInsets(Component c, Insets insets) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        return computeInsets(insets);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Returns the insets of the border.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    public Insets getBorderInsets() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        return computeInsets(new Insets(0,0,0,0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /* should be protected once api changes area allowed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    private Insets computeInsets(Insets insets) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        if (tileIcon != null && top == -1 && bottom == -1 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            left == -1 && right == -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            int w = tileIcon.getIconWidth();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            int h = tileIcon.getIconHeight();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            insets.top = h;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            insets.right = w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            insets.bottom = h;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            insets.left = w;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            insets.left = left;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            insets.top = top;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            insets.right = right;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            insets.bottom = bottom;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        return insets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * Returns the color used for tiling the border or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * if a tile icon is being used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    public Color getMatteColor() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        return color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * Returns the icon used for tiling the border or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * if a solid color is being used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    public Icon getTileIcon() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        return tileIcon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Returns whether or not the border is opaque.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    public boolean isBorderOpaque() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        // If a tileIcon is set, then it may contain transparent bits
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        return color != null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
}