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