3909N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Factory class for vending standard <code>Border</code> objects. Wherever 0N/A * possible, this factory will hand out references to shared 0N/A * <code>Border</code> instances. 0N/A * For further information and examples see 0N/A * a section in <em>The Java Tutorial</em>. 0N/A * @author David Kloba 0N/A /** Don't let anyone instantiate this class */ 0N/A//// LineBorder /////////////////////////////////////////////////////////////// 0N/A * Creates a line border withe the specified color. 0N/A * @param color a <code>Color</code> to use for the line 0N/A * @return the <code>Border</code> object 0N/A * Creates a line border with the specified color 0N/A * and width. The width applies to all four sides of the 0N/A * border. To specify widths individually for the top, 0N/A * bottom, left, and right, use 0N/A * {@link #createMatteBorder(int,int,int,int,Color)}. 0N/A * @param color a <code>Color</code> to use for the line 0N/A * @param thickness an integer specifying the width in pixels 0N/A * @return the <code>Border</code> object 2452N/A * Creates a line border with the specified color, thickness, and corner shape. 2452N/A * @param color the color of the border 2452N/A * @param thickness the thickness of the border 2452N/A * @param rounded whether or not border corners should be round 2452N/A * @return the {@code Border} object 2452N/A * @see LineBorder#LineBorder(Color, int, boolean) 0N/A//// BevelBorder ///////////////////////////////////////////////////////////// 0N/A/////////////////////////////////////////////////////////////////////////////// 0N/A * Creates a border with a raised beveled edge, using 0N/A * brighter shades of the component's current background color 0N/A * for highlighting, and darker shading for shadows. 0N/A * (In a raised border, highlights are on top and shadows 0N/A * @return the <code>Border</code> object 0N/A * Creates a border with a lowered beveled edge, using 0N/A * brighter shades of the component's current background color 0N/A * for highlighting, and darker shading for shadows. 0N/A * (In a lowered border, shadows are on top and highlights 0N/A * @return the <code>Border</code> object 0N/A * Creates a beveled border of the specified type, using 0N/A * brighter shades of the component's current background color 0N/A * for highlighting, and darker shading for shadows. 0N/A * (In a lowered border, shadows are on top and highlights 0N/A * @param type an integer specifying either 0N/A * <code>BevelBorder.LOWERED</code> or 0N/A * <code>BevelBorder.RAISED</code> 0N/A * @return the <code>Border</code> object 0N/A * Creates a beveled border of the specified type, using 0N/A * the specified highlighting and shadowing. The outer 0N/A * edge of the highlighted area uses a brighter shade of 0N/A * the highlight color. The inner edge of the shadow area 0N/A * uses a brighter shade of the shadow color. 0N/A * @param type an integer specifying either 0N/A * <code>BevelBorder.LOWERED</code> or 0N/A * <code>BevelBorder.RAISED</code> 0N/A * @param highlight a <code>Color</code> object for highlights 0N/A * @param shadow a <code>Color</code> object for shadows 0N/A * @return the <code>Border</code> object 0N/A * Creates a beveled border of the specified type, using 0N/A * the specified colors for the inner and outer highlight 0N/A * @param type an integer specifying either 0N/A * <code>BevelBorder.LOWERED</code> or 0N/A * <code>BevelBorder.RAISED</code> 0N/A * @param highlightOuter a <code>Color</code> object for the 0N/A * outer edge of the highlight area 0N/A * @param highlightInner a <code>Color</code> object for the 0N/A * inner edge of the highlight area 0N/A * @param shadowOuter a <code>Color</code> object for the 0N/A * outer edge of the shadow area 0N/A * @param shadowInner a <code>Color</code> object for the 0N/A * inner edge of the shadow area 0N/A * @return the <code>Border</code> object 2452N/A//// SoftBevelBorder /////////////////////////////////////////////////////////// 2452N/A//////////////////////////////////////////////////////////////////////////////// 2452N/A * Creates a beveled border with a raised edge and softened corners, 2452N/A * using brighter shades of the component's current background color 2452N/A * for highlighting, and darker shading for shadows. 2452N/A * In a raised border, highlights are on top and shadows are underneath. 2452N/A * @return the {@code Border} object 2452N/A * Creates a beveled border with a lowered edge and softened corners, 2452N/A * using brighter shades of the component's current background color 2452N/A * for highlighting, and darker shading for shadows. 2452N/A * In a lowered border, shadows are on top and highlights are underneath. 2452N/A * @return the {@code Border} object 2452N/A * Creates a beveled border of the specified type with softened corners, 2452N/A * using brighter shades of the component's current background color 2452N/A * for highlighting, and darker shading for shadows. 2452N/A * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}. 2452N/A * @param type a type of a bevel 2452N/A * @return the {@code Border} object or {@code null} 2452N/A * if the specified type is not valid 2452N/A * @see BevelBorder#BevelBorder(int) 2452N/A * Creates a beveled border of the specified type with softened corners, 2452N/A * using the specified highlighting and shadowing. 2452N/A * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}. 2452N/A * The outer edge of the highlight area uses 2452N/A * a brighter shade of the {@code highlight} color. 2452N/A * The inner edge of the shadow area uses 2452N/A * a brighter shade of the {@code shadow} color. 2452N/A * @param type a type of a bevel 2452N/A * @param highlight a basic color of the highlight area 2452N/A * @param shadow a basic color of the shadow area 2452N/A * @return the {@code Border} object 2452N/A * @see BevelBorder#BevelBorder(int, Color, Color) 2452N/A * Creates a beveled border of the specified type with softened corners, 2452N/A * using the specified colors for the inner and outer edges 2452N/A * of the highlight and the shadow areas. 2452N/A * The type is either {@link BevelBorder#RAISED} or {@link BevelBorder#LOWERED}. 2452N/A * Note: The shadow inner and outer colors are switched 2452N/A * for a lowered bevel border. 2452N/A * @param type a type of a bevel 2452N/A * @param highlightOuter a color of the outer edge of the highlight area 2452N/A * @param highlightInner a color of the inner edge of the highlight area 2452N/A * @param shadowOuter a color of the outer edge of the shadow area 2452N/A * @param shadowInner a color of the inner edge of the shadow area 2452N/A * @return the {@code Border} object 2452N/A * @see BevelBorder#BevelBorder(int, Color, Color, Color, Color) 0N/A//// EtchedBorder /////////////////////////////////////////////////////////// 0N/A * Creates a border with an "etched" look using 0N/A * the component's current background color for 0N/A * highlighting and shading. 0N/A * @return the <code>Border</code> object 0N/A * Creates a border with an "etched" look using 0N/A * the specified highlighting and shading colors. 0N/A * @param highlight a <code>Color</code> object for the border highlights 0N/A * @param shadow a <code>Color</code> object for the border shadows 0N/A * @return the <code>Border</code> object 0N/A * Creates a border with an "etched" look using 0N/A * the component's current background color for 0N/A * highlighting and shading. 0N/A * @param type one of <code>EtchedBorder.RAISED</code>, or 0N/A * <code>EtchedBorder.LOWERED</code> 0N/A * @return the <code>Border</code> object 0N/A * @exception IllegalArgumentException if type is not either 0N/A * <code>EtchedBorder.RAISED</code> or 0N/A * <code>EtchedBorder.LOWERED</code> 0N/A * Creates a border with an "etched" look using 0N/A * the specified highlighting and shading colors. 0N/A * @param type one of <code>EtchedBorder.RAISED</code>, or 0N/A * <code>EtchedBorder.LOWERED</code> 0N/A * @param highlight a <code>Color</code> object for the border highlights 0N/A * @param shadow a <code>Color</code> object for the border shadows 0N/A * @return the <code>Border</code> object 0N/A//// TitledBorder //////////////////////////////////////////////////////////// 0N/A * Creates a new titled border with the specified title, 0N/A * the default border type (determined by the current look and feel), 0N/A * the default text position (sitting on the top line), 0N/A * the default justification (leading), and the default 0N/A * font and text color (determined by the current look and feel). 0N/A * @param title a <code>String</code> containing the text of the title 0N/A * @return the <code>TitledBorder</code> object 0N/A * Creates a new titled border with an empty title, 0N/A * the specified border object, 0N/A * the default text position (sitting on the top line), 0N/A * the default justification (leading), and the default 0N/A * font and text color (determined by the current look and feel). 0N/A * @param border the <code>Border</code> object to add the title to; if 0N/A * <code>null</code> the <code>Border</code> is determined 0N/A * by the current look and feel. 0N/A * @return the <code>TitledBorder</code> object 0N/A * Adds a title to an existing border, 0N/A * with default positioning (sitting on the top line), 0N/A * default justification (leading) and the default 0N/A * font and text color (determined by the current look and feel). 0N/A * @param border the <code>Border</code> object to add the title to 0N/A * @param title a <code>String</code> containing the text of the title 0N/A * @return the <code>TitledBorder</code> object 0N/A * Adds a title to an existing border, with the specified 0N/A * positioning and using the default 0N/A * font and text color (determined by the current look and feel). 0N/A * @param border the <code>Border</code> object to add the title to 0N/A * @param title a <code>String</code> containing the text of the title 0N/A * @param titleJustification an integer specifying the justification 0N/A * of the title -- one of the following: 0N/A *<li><code>TitledBorder.LEFT</code> 0N/A *<li><code>TitledBorder.CENTER</code> 0N/A *<li><code>TitledBorder.RIGHT</code> 0N/A *<li><code>TitledBorder.LEADING</code> 0N/A *<li><code>TitledBorder.TRAILING</code> 0N/A *<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading) 0N/A * @param titlePosition an integer specifying the vertical position of 0N/A * the text in relation to the border -- one of the following: 0N/A *<li><code> TitledBorder.ABOVE_TOP</code> 0N/A *<li><code>TitledBorder.TOP</code> (sitting on the top line) 0N/A *<li><code>TitledBorder.BELOW_TOP</code> 0N/A *<li><code>TitledBorder.ABOVE_BOTTOM</code> 0N/A *<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line) 0N/A *<li><code>TitledBorder.BELOW_BOTTOM</code> 0N/A *<li><code>TitledBorder.DEFAULT_POSITION</code> (top) 0N/A * @return the <code>TitledBorder</code> object 0N/A * Adds a title to an existing border, with the specified 0N/A * positioning and font, and using the default text color 0N/A * (determined by the current look and feel). 0N/A * @param border the <code>Border</code> object to add the title to 0N/A * @param title a <code>String</code> containing the text of the title 0N/A * @param titleJustification an integer specifying the justification 0N/A * of the title -- one of the following: 0N/A *<li><code>TitledBorder.LEFT</code> 0N/A *<li><code>TitledBorder.CENTER</code> 0N/A *<li><code>TitledBorder.RIGHT</code> 0N/A *<li><code>TitledBorder.LEADING</code> 0N/A *<li><code>TitledBorder.TRAILING</code> 0N/A *<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading) 0N/A * @param titlePosition an integer specifying the vertical position of 0N/A * the text in relation to the border -- one of the following: 0N/A *<li><code> TitledBorder.ABOVE_TOP</code> 0N/A *<li><code>TitledBorder.TOP</code> (sitting on the top line) 0N/A *<li><code>TitledBorder.BELOW_TOP</code> 0N/A *<li><code>TitledBorder.ABOVE_BOTTOM</code> 0N/A *<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line) 0N/A *<li><code>TitledBorder.BELOW_BOTTOM</code> 0N/A *<li><code>TitledBorder.DEFAULT_POSITION</code> (top) 0N/A * @param titleFont a Font object specifying the title font 0N/A * @return the TitledBorder object 0N/A * Adds a title to an existing border, with the specified 0N/A * positioning, font and color. 0N/A * @param border the <code>Border</code> object to add the title to 0N/A * @param title a <code>String</code> containing the text of the title 0N/A * @param titleJustification an integer specifying the justification 0N/A * of the title -- one of the following: 0N/A *<li><code>TitledBorder.LEFT</code> 0N/A *<li><code>TitledBorder.CENTER</code> 0N/A *<li><code>TitledBorder.RIGHT</code> 0N/A *<li><code>TitledBorder.LEADING</code> 0N/A *<li><code>TitledBorder.TRAILING</code> 0N/A *<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading) 0N/A * @param titlePosition an integer specifying the vertical position of 0N/A * the text in relation to the border -- one of the following: 0N/A *<li><code> TitledBorder.ABOVE_TOP</code> 0N/A *<li><code>TitledBorder.TOP</code> (sitting on the top line) 0N/A *<li><code>TitledBorder.BELOW_TOP</code> 0N/A *<li><code>TitledBorder.ABOVE_BOTTOM</code> 0N/A *<li><code>TitledBorder.BOTTOM</code> (sitting on the bottom line) 0N/A *<li><code>TitledBorder.BELOW_BOTTOM</code> 0N/A *<li><code>TitledBorder.DEFAULT_POSITION</code> (top) 0N/A * @param titleFont a <code>Font</code> object specifying the title font 0N/A * @param titleColor a <code>Color</code> object specifying the title color 0N/A * @return the <code>TitledBorder</code> object 0N/A//// EmptyBorder /////////////////////////////////////////////////////////// 0N/A * Creates an empty border that takes up no space. (The width 0N/A * of the top, bottom, left, and right sides are all zero.) 0N/A * @return the <code>Border</code> object 0N/A * Creates an empty border that takes up space but which does 0N/A * no drawing, specifying the width of the top, left, bottom, and 0N/A * @param top an integer specifying the width of the top, 0N/A * @param left an integer specifying the width of the left side, 0N/A * @param bottom an integer specifying the width of the bottom, 0N/A * @param right an integer specifying the width of the right side, 0N/A * @return the <code>Border</code> object 0N/A//// CompoundBorder //////////////////////////////////////////////////////// 0N/A * Creates a compound border with a <code>null</code> inside edge and a 0N/A * <code>null</code> outside edge. 0N/A * @return the <code>CompoundBorder</code> object 0N/A * Creates a compound border specifying the border objects to use 0N/A * for the outside and inside edges. 0N/A * @param outsideBorder a <code>Border</code> object for the outer 0N/A * edge of the compound border 0N/A * @param insideBorder a <code>Border</code> object for the inner 0N/A * edge of the compound border 0N/A * @return the <code>CompoundBorder</code> object 0N/A//// MatteBorder //////////////////////////////////////////////////////// 0N/A * Creates a matte-look border using a solid color. (The difference between 0N/A * this border and a line border is that you can specify the individual 0N/A * border dimensions.) 0N/A * @param top an integer specifying the width of the top, 0N/A * @param left an integer specifying the width of the left side, 0N/A * @param bottom an integer specifying the width of the right side, 0N/A * @param right an integer specifying the width of the bottom, 0N/A * @param color a <code>Color</code> to use for the border 0N/A * @return the <code>MatteBorder</code> object 0N/A * Creates a matte-look border that consists of multiple tiles of a 0N/A * specified icon. Multiple copies of the icon are placed side-by-side 0N/A * to fill up the border area. 0N/A * If the icon doesn't load, the border area is painted gray. 0N/A * @param top an integer specifying the width of the top, 0N/A * @param left an integer specifying the width of the left side, 0N/A * @param bottom an integer specifying the width of the right side, 0N/A * @param right an integer specifying the width of the bottom, 0N/A * @param tileIcon the <code>Icon</code> object used for the border tiles 0N/A * @return the <code>MatteBorder</code> object 2965N/A//// StrokeBorder ////////////////////////////////////////////////////////////// 2965N/A//////////////////////////////////////////////////////////////////////////////// 2965N/A * Creates a border of the specified {@code stroke}. 2965N/A * The component's foreground color will be used to render the border. 2965N/A * @param stroke the {@link BasicStroke} object used to stroke a shape 2965N/A * @return the {@code Border} object 2965N/A * @throws NullPointerException if the specified {@code stroke} is {@code null} 2965N/A * Creates a border of the specified {@code stroke} and {@code paint}. 2965N/A * If the specified {@code paint} is {@code null}, 2965N/A * the component's foreground color will be used to render the border. 2965N/A * @param stroke the {@link BasicStroke} object used to stroke a shape 2965N/A * @param paint the {@link Paint} object used to generate a color 2965N/A * @return the {@code Border} object 2965N/A * @throws NullPointerException if the specified {@code stroke} is {@code null} 2965N/A//// DashedBorder ////////////////////////////////////////////////////////////// 2965N/A//////////////////////////////////////////////////////////////////////////////// 2965N/A * Creates a dashed border of the specified {@code paint}. 2965N/A * If the specified {@code paint} is {@code null}, 2965N/A * the component's foreground color will be used to render the border. 2965N/A * The width of a dash line is equal to {@code 1}. 2965N/A * The relative length of a dash line and 2965N/A * the relative spacing between dash lines are equal to {@code 1}. 2965N/A * A dash line is not rounded. 2965N/A * @param paint the {@link Paint} object used to generate a color 2965N/A * @return the {@code Border} object 2965N/A * Creates a dashed border of the specified {@code paint}, 2965N/A * relative {@code length}, and relative {@code spacing}. 2965N/A * If the specified {@code paint} is {@code null}, 2965N/A * the component's foreground color will be used to render the border. 2965N/A * The width of a dash line is equal to {@code 1}. 2965N/A * A dash line is not rounded. 2965N/A * @param paint the {@link Paint} object used to generate a color 2965N/A * @param length the relative length of a dash line 2965N/A * @param spacing the relative spacing between dash lines 2965N/A * @return the {@code Border} object 2965N/A * @throws IllegalArgumentException if the specified {@code length} is less than {@code 1}, or 2965N/A * if the specified {@code spacing} is less than {@code 0} 2965N/A * Creates a dashed border of the specified {@code paint}, {@code thickness}, 2965N/A * line shape, relative {@code length}, and relative {@code spacing}. 2965N/A * If the specified {@code paint} is {@code null}, 2965N/A * the component's foreground color will be used to render the border. 2965N/A * @param paint the {@link Paint} object used to generate a color 2965N/A * @param thickness the width of a dash line 2965N/A * @param length the relative length of a dash line 2965N/A * @param spacing the relative spacing between dash lines 2965N/A * @param rounded whether or not line ends should be round 2965N/A * @return the {@code Border} object 2965N/A * @throws IllegalArgumentException if the specified {@code thickness} is less than {@code 1}, or 2965N/A * if the specified {@code length} is less than {@code 1}, or 2965N/A * if the specified {@code spacing} is less than {@code 0}