/*
* @(#)BorderFactory.java 1.35 05/11/17
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.swing;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JComponent;
import javax.swing.border.*;
/**
* Factory class for vending standard <code>Border</code> objects. Wherever
* possible, this factory will hand out references to shared
* <code>Border</code> instances.
* For further information and examples see
* <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/border.html">How
to Use Borders</a>,
* a section in <em>The Java Tutorial</em>.
*
* @version 1.35 11/17/05
* @author David Kloba
*/
public class BorderFactory
{
/** Don't let anyone instantiate this class */
private BorderFactory() {
}
//// LineBorder ///////////////////////////////////////////////////////////////
/**
* Creates a line border withe the specified color.
*
* @param color a <code>Color</code> to use for the line
* @return the <code>Border</code> object
*/
public static Border createLineBorder(Color color) {
return new LineBorder(color, 1);
}
/**
* Creates a line border with the specified color
* and width. The width applies to all four sides of the
* border. To specify widths individually for the top,
* bottom, left, and right, use
* {@link #createMatteBorder(int,int,int,int,Color)}.
*
* @param color a <code>Color</code> to use for the line
* @param thickness an integer specifying the width in pixels
* @return the <code>Border</code> object
*/
public static Border createLineBorder(Color color, int thickness) {
return new LineBorder(color, thickness);
}
// public static Border createLineBorder(Color color, int thickness,
// boolean drawRounded) {
// return new JLineBorder(color, thickness, drawRounded);
// }
//// BevelBorder /////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static final Border sharedRaisedBevel = new BevelBorder(BevelBorder.RAISED);
static final Border sharedLoweredBevel = new BevelBorder(BevelBorder.LOWERED);
/**
* Creates a border with a raised beveled edge, using
* brighter shades of the component's current background color
* for highlighting, and darker shading for shadows.
* (In a raised border, highlights are on top and shadows
* are underneath.)
*
* @return the <code>Border</code> object
*/
public static Border createRaisedBevelBorder() {
return createSharedBevel(BevelBorder.RAISED);
}
/**
* Creates a border with a lowered beveled edge, using
* brighter shades of the component's current background color
* for highlighting, and darker shading for shadows.
* (In a lowered border, shadows are on top and highlights
* are underneath.)
*
* @return the <code>Border</code> object
*/
public static Border createLoweredBevelBorder() {
return createSharedBevel(BevelBorder.LOWERED);
}
/**
* Creates a beveled border of the specified type, using
* brighter shades of the component's current background color
* for highlighting, and darker shading for shadows.
* (In a lowered border, shadows are on top and highlights
=1= |