* @exception IllegalArgumentException if type is not either
* <code>EtchedBorder.RAISED</code> or
* <code>EtchedBorder.LOWERED</code>
* @since 1.3
*/
public static Border createEtchedBorder(int type) {
switch (type) {
case EtchedBorder.RAISED:
if (sharedRaisedEtchedBorder == null) {
sharedRaisedEtchedBorder = new EtchedBorder
(EtchedBorder.RAISED);
}
return sharedRaisedEtchedBorder;
case EtchedBorder.LOWERED:
return sharedEtchedBorder;
default:
throw new IllegalArgumentException("type must be one of EtchedBorder.RAISED or EtchedBorder.LOWERED");
}
}
/**
* Creates a border with an "etched" look using
* the specified highlighting and shading colors.
*
* @param type one of <code>EtchedBorder.RAISED</code>, or
* <code>EtchedBorder.LOWERED</code>
* @param highlight a <code>Color</code> object for the border highlights
* @param shadow a <code>Color</code> object for the border shadows
* @return the <code>Border</code> object
* @since 1.3
*/
public static Border createEtchedBorder(int type, Color highlight,
Color shadow) {
return new EtchedBorder(type, highlight, shadow);
}
//// TitledBorder ////////////////////////////////////////////////////////////
/**
* Creates a new titled border with the specified title,
* the default border type (determined by the current look and feel),
* the default text position (sitting on the top line),
* the default justification (leading), and the default
* font and text color (determined by the current look and feel).
*
* @param title a <code>String</code> containing the text of the title
* @return the <code>TitledBorder</code> object
*/
public static TitledBorder createTitledBorder(String title) {
return new TitledBorder(title);
}
/**
* Creates a new titled border with an empty title,
* the specified border object,
* the default text position (sitting on the top line),
* the default justification (leading), and the default
* font and text color (determined by the current look and feel).
*
* @param border the <code>Border</code> object to add the title to; if
* <code>null</code> the <code>Border</code> is determined
* by the current look and feel.
* @return the <code>TitledBorder</code> object
*/
public static TitledBorder createTitledBorder(Border border) {
return new TitledBorder(border);
}
/**
* Adds a title to an existing border,
* with default positioning (sitting on the top line),
* default justification (leading) and the default
* font and text color (determined by the current look and feel).
*
* @param border the <code>Border</code> object to add the title to
* @param title a <code>String</code> containing the text of the title
* @return the <code>TitledBorder</code> object
*/
public static TitledBorder createTitledBorder(Border border,
String title) {
return new TitledBorder(border, title);
}
/**
* Adds a title to an existing border, with the specified
* positioning and using the default
* font and text color (determined by the current look and feel).
*
* @param border the <code>Border</code> object to add the title to
* @param title a <code>String</code> containing the text of the title
* @param titleJustification an integer specifying the justification
* of the title -- one of the following:
*<ul>
*<li><code>TitledBorder.LEFT</code>
*<li><code>TitledBorder.CENTER</code>
*<li><code>TitledBorder.RIGHT</code>
*<li><code>TitledBorder.LEADING</code>
*<li><code>TitledBorder.TRAILING</code>
*<li><code>TitledBorder.DEFAULT_JUSTIFICATION</code> (leading)
*</ul>
* @param titlePosition an integer specifying the vertical position of
=3= |