jdk/src/share/classes/javax/swing/BorderFactory.java
author alexp
Fri, 02 Jul 2010 19:34:34 +0400
changeset 5956 e30f106a4b8b
parent 5765 b9ebe03ab870
child 7006 05505fff1342
permissions -rw-r--r--
6937415: Some components return undocumented default values under Nimbus LaF Reviewed-by: peterz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5765
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
     2
 * Copyright (c) 1997, 2010, 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;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.Color;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Font;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.swing.border.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * Factory class for vending standard <code>Border</code> objects.  Wherever
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * possible, this factory will hand out references to shared
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <code>Border</code> instances.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * For further information and examples see
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/border.html">How
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 to Use Borders</a>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * a section in <em>The Java Tutorial</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @author David Kloba
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
public class BorderFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    /** Don't let anyone instantiate this class */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    private BorderFactory() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
//// LineBorder ///////////////////////////////////////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * Creates a line border withe the specified color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * @param color  a <code>Color</code> to use for the line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    public static Border createLineBorder(Color color) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
        return new LineBorder(color, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * Creates a line border with the specified color
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * and width. The width applies to all four sides of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * border. To specify widths individually for the top,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * bottom, left, and right, use
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * {@link #createMatteBorder(int,int,int,int,Color)}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * @param color  a <code>Color</code> to use for the line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @param thickness  an integer specifying the width in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public static Border createLineBorder(Color color, int thickness)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        return new LineBorder(color, thickness);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
5765
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    76
    /**
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    77
     * Creates a line border with the specified color, thickness, and corner shape.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    78
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    79
     * @param color      the color of the border
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    80
     * @param thickness  the thickness of the border
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    81
     * @param rounded    whether or not border corners should be round
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    82
     * @return the {@code Border} object
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    83
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    84
     * @see LineBorder#LineBorder(Color, int, boolean)
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    85
     * @since 1.7
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    86
     */
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    87
    public static Border createLineBorder(Color color, int thickness, boolean rounded) {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    88
        return new LineBorder(color, thickness, rounded);
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
    89
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
//// BevelBorder /////////////////////////////////////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
///////////////////////////////////////////////////////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    static final Border sharedRaisedBevel = new BevelBorder(BevelBorder.RAISED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    static final Border sharedLoweredBevel = new BevelBorder(BevelBorder.LOWERED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * Creates a border with a raised beveled edge, using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * brighter shades of the component's current background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * for highlighting, and darker shading for shadows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * (In a raised border, highlights are on top and shadows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *  are underneath.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    public static Border createRaisedBevelBorder() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        return createSharedBevel(BevelBorder.RAISED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * Creates a border with a lowered beveled edge, using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * brighter shades of the component's current background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * for highlighting, and darker shading for shadows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * (In a lowered border, shadows are on top and highlights
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *  are underneath.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    public static Border createLoweredBevelBorder() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        return createSharedBevel(BevelBorder.LOWERED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * Creates a beveled border of the specified type, using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * brighter shades of the component's current background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * for highlighting, and darker shading for shadows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * (In a lowered border, shadows are on top and highlights
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *  are underneath.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @param type  an integer specifying either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *                  <code>BevelBorder.LOWERED</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *                  <code>BevelBorder.RAISED</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public static Border createBevelBorder(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        return createSharedBevel(type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * Creates a beveled border of the specified type, using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * the specified highlighting and shadowing. The outer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * edge of the highlighted area uses a brighter shade of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * the highlight color. The inner edge of the shadow area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * uses a brighter shade of the shadow color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * @param type  an integer specifying either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     *                  <code>BevelBorder.LOWERED</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     *                  <code>BevelBorder.RAISED</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @param highlight  a <code>Color</code> object for highlights
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @param shadow     a <code>Color</code> object for shadows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    public static Border createBevelBorder(int type, Color highlight, Color shadow) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        return new BevelBorder(type, highlight, shadow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * Creates a beveled border of the specified type, using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * the specified colors for the inner and outer highlight
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * and shadow areas.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * Note: The shadow inner and outer colors are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * switched for a lowered bevel border.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @param type  an integer specifying either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *          <code>BevelBorder.LOWERED</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *          <code>BevelBorder.RAISED</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @param highlightOuter  a <code>Color</code> object for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *                  outer edge of the highlight area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @param highlightInner  a <code>Color</code> object for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *                  inner edge of the highlight area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @param shadowOuter     a <code>Color</code> object for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     *                  outer edge of the shadow area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @param shadowInner     a <code>Color</code> object for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     *                  inner edge of the shadow area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    public static Border createBevelBorder(int type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                        Color highlightOuter, Color highlightInner,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                        Color shadowOuter, Color shadowInner) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        return new BevelBorder(type, highlightOuter, highlightInner,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                                        shadowOuter, shadowInner);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    static Border createSharedBevel(int type)   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        if(type == BevelBorder.RAISED) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            return sharedRaisedBevel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        } else if(type == BevelBorder.LOWERED) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            return sharedLoweredBevel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
5765
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   192
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   193
//// SoftBevelBorder ///////////////////////////////////////////////////////////
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   194
////////////////////////////////////////////////////////////////////////////////
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   195
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   196
    private static Border sharedSoftRaisedBevel;
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   197
    private static Border sharedSoftLoweredBevel;
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   198
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   199
    /**
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   200
     * Creates a beveled border with a raised edge and softened corners,
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   201
     * using brighter shades of the component's current background color
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   202
     * for highlighting, and darker shading for shadows.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   203
     * In a raised border, highlights are on top and shadows are underneath.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   204
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   205
     * @return the {@code Border} object
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   206
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   207
     * @since 1.7
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   208
     */
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   209
    public static Border createRaisedSoftBevelBorder() {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   210
        if (sharedSoftRaisedBevel == null) {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   211
            sharedSoftRaisedBevel = new SoftBevelBorder(BevelBorder.RAISED);
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   212
        }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   213
        return sharedSoftRaisedBevel;
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   214
    }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   215
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   216
    /**
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   217
     * Creates a beveled border with a lowered edge and softened corners,
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   218
     * using brighter shades of the component's current background color
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   219
     * for highlighting, and darker shading for shadows.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   220
     * In a lowered border, shadows are on top and highlights are underneath.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   221
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   222
     * @return the {@code Border} object
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   223
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   224
     * @since 1.7
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   225
     */
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   226
    public static Border createLoweredSoftBevelBorder() {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   227
        if (sharedSoftLoweredBevel == null) {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   228
            sharedSoftLoweredBevel = new SoftBevelBorder(BevelBorder.LOWERED);
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   229
        }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   230
        return sharedSoftLoweredBevel;
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   231
    }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   232
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   233
    /**
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   234
     * Creates a beveled border of the specified type with softened corners,
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   235
     * using brighter shades of the component's current background color
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   236
     * for highlighting, and darker shading for shadows.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   237
     * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   238
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   239
     * @param type  a type of a bevel
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   240
     * @return the {@code Border} object or {@code null}
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   241
     *         if the specified type is not valid
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   242
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   243
     * @see BevelBorder#BevelBorder(int)
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   244
     * @since 1.7
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   245
     */
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   246
    public static Border createSoftBevelBorder(int type) {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   247
        if (type == BevelBorder.RAISED) {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   248
            return createRaisedSoftBevelBorder();
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   249
        }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   250
        if (type == BevelBorder.LOWERED) {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   251
            return createLoweredSoftBevelBorder();
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   252
        }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   253
        return null;
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   254
    }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   255
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   256
    /**
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   257
     * Creates a beveled border of the specified type with softened corners,
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   258
     * using the specified highlighting and shadowing.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   259
     * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   260
     * The outer edge of the highlight area uses
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   261
     * a brighter shade of the {@code highlight} color.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   262
     * The inner edge of the shadow area uses
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   263
     * a brighter shade of the {@code shadow} color.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   264
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   265
     * @param type       a type of a bevel
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   266
     * @param highlight  a basic color of the highlight area
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   267
     * @param shadow     a basic color of the shadow area
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   268
     * @return the {@code Border} object
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   269
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   270
     * @see BevelBorder#BevelBorder(int, Color, Color)
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   271
     * @since 1.7
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   272
     */
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   273
    public static Border createSoftBevelBorder(int type, Color highlight, Color shadow) {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   274
        return new BevelBorder(type, highlight, shadow);
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   275
    }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   276
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   277
    /**
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   278
     * Creates a beveled border of the specified type with softened corners,
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   279
     * using the specified colors for the inner and outer edges
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   280
     * of the highlight and the shadow areas.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   281
     * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   282
     * Note: The shadow inner and outer colors are switched
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   283
     * for a lowered bevel border.
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   284
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   285
     * @param type            a type of a bevel
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   286
     * @param highlightOuter  a color of the outer edge of the highlight area
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   287
     * @param highlightInner  a color of the inner edge of the highlight area
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   288
     * @param shadowOuter     a color of the outer edge of the shadow area
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   289
     * @param shadowInner     a color of the inner edge of the shadow area
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   290
     * @return the {@code Border} object
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   291
     *
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   292
     * @see BevelBorder#BevelBorder(int, Color, Color, Color, Color)
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   293
     * @since 1.7
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   294
     */
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   295
    public static Border createSoftBevelBorder(int type, Color highlightOuter, Color highlightInner, Color shadowOuter, Color shadowInner) {
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   296
        return new BevelBorder(type, highlightOuter, highlightInner, shadowOuter, shadowInner);
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   297
    }
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   298
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
//// EtchedBorder ///////////////////////////////////////////////////////////
5765
b9ebe03ab870 5066685: BorderFactory lacks SoftBevelBorder support
malenkov
parents: 5506
diff changeset
   300
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    static final Border sharedEtchedBorder = new EtchedBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    private static Border sharedRaisedEtchedBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * Creates a border with an "etched" look using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * the component's current background color for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * highlighting and shading.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    public static Border createEtchedBorder()    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        return sharedEtchedBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * Creates a border with an "etched" look using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * the specified highlighting and shading colors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @param highlight  a <code>Color</code> object for the border highlights
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @param shadow     a <code>Color</code> object for the border shadows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    public static Border createEtchedBorder(Color highlight, Color shadow)    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        return new EtchedBorder(highlight, shadow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * Creates a border with an "etched" look using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * the component's current background color for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * highlighting and shading.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * @param type      one of <code>EtchedBorder.RAISED</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     *                  <code>EtchedBorder.LOWERED</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * @exception IllegalArgumentException if type is not either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *                  <code>EtchedBorder.RAISED</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     *                  <code>EtchedBorder.LOWERED</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    public static Border createEtchedBorder(int type)    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        case EtchedBorder.RAISED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
            if (sharedRaisedEtchedBorder == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                sharedRaisedEtchedBorder = new EtchedBorder
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                                           (EtchedBorder.RAISED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
            return sharedRaisedEtchedBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        case EtchedBorder.LOWERED:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
            return sharedEtchedBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            throw new IllegalArgumentException("type must be one of EtchedBorder.RAISED or EtchedBorder.LOWERED");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * Creates a border with an "etched" look using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * the specified highlighting and shading colors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @param type      one of <code>EtchedBorder.RAISED</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     *                  <code>EtchedBorder.LOWERED</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @param highlight  a <code>Color</code> object for the border highlights
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * @param shadow     a <code>Color</code> object for the border shadows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    public static Border createEtchedBorder(int type, Color highlight,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                                            Color shadow)    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        return new EtchedBorder(type, highlight, shadow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
//// TitledBorder ////////////////////////////////////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * Creates a new titled border with the specified title,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * the default border type (determined by the current look and feel),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * the default text position (sitting on the top line),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * the default justification (leading), and the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * font and text color (determined by the current look and feel).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @param title      a <code>String</code> containing the text of the title
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @return the <code>TitledBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    public static TitledBorder createTitledBorder(String title)     {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        return new TitledBorder(title);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * Creates a new titled border with an empty title,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * the specified border object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * the default text position (sitting on the top line),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * the default justification (leading), and the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * font and text color (determined by the current look and feel).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * @param border     the <code>Border</code> object to add the title to; if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     *                   <code>null</code> the <code>Border</code> is determined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     *                   by the current look and feel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @return the <code>TitledBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    public static TitledBorder createTitledBorder(Border border)       {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        return new TitledBorder(border);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * Adds a title to an existing border,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * with default positioning (sitting on the top line),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * default justification (leading) and the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * font and text color (determined by the current look and feel).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * @param border     the <code>Border</code> object to add the title to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @param title      a <code>String</code> containing the text of the title
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * @return the <code>TitledBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    public static TitledBorder createTitledBorder(Border border,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
                                                   String title) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        return new TitledBorder(border, title);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * Adds a title to an existing border, with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * positioning and using the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * font and text color (determined by the current look and feel).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * @param border      the <code>Border</code> object to add the title to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * @param title       a <code>String</code> containing the text of the title
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * @param titleJustification  an integer specifying the justification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     *        of the title -- one of the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     *<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     *<li><code>TitledBorder.LEFT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     *<li><code>TitledBorder.CENTER</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     *<li><code>TitledBorder.RIGHT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     *<li><code>TitledBorder.LEADING</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     *<li><code>TitledBorder.TRAILING</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     *<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * @param titlePosition       an integer specifying the vertical position of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     *        the text in relation to the border -- one of the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     *<li><code> TitledBorder.ABOVE_TOP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     *<li><code>TitledBorder.TOP</code> (sitting on the top line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     *<li><code>TitledBorder.BELOW_TOP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     *<li><code>TitledBorder.ABOVE_BOTTOM</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     *<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     *<li><code>TitledBorder.BELOW_BOTTOM</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     *<li><code>TitledBorder.DEFAULT_POSITION</code> (top)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @return the <code>TitledBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    public static TitledBorder createTitledBorder(Border border,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                        String title,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                        int titleJustification,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                        int titlePosition)      {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        return new TitledBorder(border, title, titleJustification,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
                        titlePosition);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * Adds a title to an existing border, with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * positioning and font, and using the default text color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * (determined by the current look and feel).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * @param border      the <code>Border</code> object to add the title to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @param title       a <code>String</code> containing the text of the title
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * @param titleJustification  an integer specifying the justification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     *        of the title -- one of the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     *<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     *<li><code>TitledBorder.LEFT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     *<li><code>TitledBorder.CENTER</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     *<li><code>TitledBorder.RIGHT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     *<li><code>TitledBorder.LEADING</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     *<li><code>TitledBorder.TRAILING</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     *<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * @param titlePosition       an integer specifying the vertical position of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     *        the text in relation to the border -- one of the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     *<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     *<li><code> TitledBorder.ABOVE_TOP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     *<li><code>TitledBorder.TOP</code> (sitting on the top line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     *<li><code>TitledBorder.BELOW_TOP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     *<li><code>TitledBorder.ABOVE_BOTTOM</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     *<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     *<li><code>TitledBorder.BELOW_BOTTOM</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     *<li><code>TitledBorder.DEFAULT_POSITION</code> (top)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     * @param titleFont           a Font object specifying the title font
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * @return the TitledBorder object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    public static TitledBorder createTitledBorder(Border border,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                        String title,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
                        int titleJustification,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                        int titlePosition,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                        Font titleFont) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        return new TitledBorder(border, title, titleJustification,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                        titlePosition, titleFont);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     * Adds a title to an existing border, with the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * positioning, font and color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * @param border      the <code>Border</code> object to add the title to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * @param title       a <code>String</code> containing the text of the title
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     * @param titleJustification  an integer specifying the justification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     *        of the title -- one of the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     *<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     *<li><code>TitledBorder.LEFT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     *<li><code>TitledBorder.CENTER</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     *<li><code>TitledBorder.RIGHT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     *<li><code>TitledBorder.LEADING</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     *<li><code>TitledBorder.TRAILING</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     *<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * @param titlePosition       an integer specifying the vertical position of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     *        the text in relation to the border -- one of the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     *<ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     *<li><code> TitledBorder.ABOVE_TOP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     *<li><code>TitledBorder.TOP</code> (sitting on the top line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     *<li><code>TitledBorder.BELOW_TOP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     *<li><code>TitledBorder.ABOVE_BOTTOM</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     *<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     *<li><code>TitledBorder.BELOW_BOTTOM</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     *<li><code>TitledBorder.DEFAULT_POSITION</code> (top)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     *</ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * @param titleFont   a <code>Font</code> object specifying the title font
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     * @param titleColor  a <code>Color</code> object specifying the title color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     * @return the <code>TitledBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    public static TitledBorder createTitledBorder(Border border,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                        String title,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
                        int titleJustification,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
                        int titlePosition,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
                        Font titleFont,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
                        Color titleColor)       {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
        return new TitledBorder(border, title, titleJustification,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
                        titlePosition, titleFont, titleColor);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
//// EmptyBorder ///////////////////////////////////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
    final static Border emptyBorder = new EmptyBorder(0, 0, 0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     * Creates an empty border that takes up no space. (The width
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     * of the top, bottom, left, and right sides are all zero.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    public static Border createEmptyBorder() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        return emptyBorder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * Creates an empty border that takes up space but which does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     * no drawing, specifying the width of the top, left, bottom, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     * right sides.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     * @param top     an integer specifying the width of the top,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     *                  in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     * @param left    an integer specifying the width of the left side,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     *                  in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * @param bottom  an integer specifying the width of the bottom,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     *                  in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     * @param right   an integer specifying the width of the right side,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     *                  in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     * @return the <code>Border</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
    public static Border createEmptyBorder(int top, int left,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
                                                int bottom, int right) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
        return new EmptyBorder(top, left, bottom, right);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
//// CompoundBorder ////////////////////////////////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * Creates a compound border with a <code>null</code> inside edge and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     * <code>null</code> outside edge.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * @return the <code>CompoundBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    public static CompoundBorder createCompoundBorder() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        return new CompoundBorder();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * Creates a compound border specifying the border objects to use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     * for the outside and inside edges.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * @param outsideBorder  a <code>Border</code> object for the outer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     *                          edge of the compound border
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     * @param insideBorder   a <code>Border</code> object for the inner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     *                          edge of the compound border
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * @return the <code>CompoundBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    public static CompoundBorder createCompoundBorder(Border outsideBorder,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
                                                Border insideBorder) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
        return new CompoundBorder(outsideBorder, insideBorder);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
//// MatteBorder ////////////////////////////////////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * Creates a matte-look border using a solid color. (The difference between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * this border and a line border is that you can specify the individual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * border dimensions.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     * @param top     an integer specifying the width of the top,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     *                          in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     * @param left    an integer specifying the width of the left side,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     *                          in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
     * @param bottom  an integer specifying the width of the right side,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     *                          in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     * @param right   an integer specifying the width of the bottom,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     *                          in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * @param color   a <code>Color</code> to use for the border
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * @return the <code>MatteBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
    public static MatteBorder createMatteBorder(int top, int left, int bottom, int right,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
                                                Color color) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
        return new MatteBorder(top, left, bottom, right, color);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * Creates a matte-look border that consists of multiple tiles of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * specified icon. Multiple copies of the icon are placed side-by-side
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     * to fill up the border area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * Note:<br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * If the icon doesn't load, the border area is painted gray.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     * @param top     an integer specifying the width of the top,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     *                          in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * @param left    an integer specifying the width of the left side,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     *                          in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     * @param bottom  an integer specifying the width of the right side,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     *                          in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * @param right   an integer specifying the width of the bottom,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     *                          in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     * @param tileIcon  the <code>Icon</code> object used for the border tiles
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     * @return the <code>MatteBorder</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
    public static MatteBorder createMatteBorder(int top, int left, int bottom, int right,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
                                                Icon tileIcon) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        return new MatteBorder(top, left, bottom, right, tileIcon);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
}