|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.Borders
Class Borders redesigns the Java class
BorderFactory by providing brief names for
many methods in that class and by providing additional
convenience methods that do not exist in that class.
In particular, this class provides new methods to
create etch and bevel style borders
with a levels parameter that controls
the border thickness.
Technical Note: Many of the complex borders are made
using compounds of MatteBorder objects and
so the return types will not match the classic Java
border classes.
This class cannot be instantiated.
| Field Summary | |
static int |
ABOVE_BOTTOM
The int TitledBorder.ABOVE_BOTTOM. |
static int |
ABOVE_TOP
The int TitledBorder.ABOVE_TOP. |
static int |
BELOW_BOTTOM
The int TitledBorder.BELOW_BOTTOM. |
static int |
BELOW_TOP
The int TitledBorder.BELOW_TOP. |
static int |
BOTTOM
The int TitledBorder.BOTTOM. |
static int |
CENTER
The int TitledBorder.CENTER. |
static Border |
DEFAULT_LINE_BORDER
The default line border for a titled border, namely, line(Color.black,2). |
static int |
H_DEFAULT
The horizontal default for a titled border that we take to be ( CENTER) rather than
the Java default (LEADING). |
static int |
LEADING
The int TitledBorder.LEADING. |
static int |
LEFT
The int TitledBorder.LEFT. |
static int |
RIGHT
The int TitledBorder.RIGHT. |
static int |
TOP
The int TitledBorder.TOP. |
static int |
TRAILING
The int TitledBorder.TRAILING. |
static int |
V_DEFAULT
The vertical default for a titled border that is ( TOP) as in Java. |
| Constructor Summary | |
private |
Borders()
Private constructor to prevent instantiation. |
| Method Summary | |
static Border |
bevelLowered()
Creates a default lowered bevel border. |
static Border |
bevelLowered(Color highlight,
Color shadow)
Creates a lowered bevel border with the given highlight and shadow colors. |
static Border |
bevelLowered(Color highlightOuter,
Color highlightInner,
Color shadowInner,
Color shadowOuter)
Creates a lowered bevel border with the given outer and inner highlight colors and the given outer and inner shadow colors. |
static Border |
bevelLowered(int levels,
Color highlight,
Color shadow)
Creates a lowered bevel border in which the thickness of each edge is equal to the number of levels. |
static Border |
bevelLowered(int levels,
Color highlightOuter,
Color highlightInner,
Color shadowInner,
Color shadowOuter)
Creates a lowered bevel border in which the thickness of each edge is equal to the number of levels. |
static Border |
bevelRaised()
Creates a default raised bevel border. |
static Border |
bevelRaised(Color highlight,
Color shadow)
Creates a raised bevel border with the given highlight and shadow colors. |
static Border |
bevelRaised(Color highlightOuter,
Color highlightInner,
Color shadowInner,
Color shadowOuter)
Creates a lowered bevel border with the given outer and inner highlight colors and the given outer and inner shadow colors. |
static Border |
bevelRaised(int levels,
Color highlight,
Color shadow)
Creates a raised bevel border in which the thickness of each edge is equal to the number of levels. |
static Border |
bevelRaised(int levels,
Color highlightOuter,
Color highlightInner,
Color shadowInner,
Color shadowOuter)
Creates a raised bevel border in which the thickness of each edge is equal to the number of levels. |
static Border |
compound(Border[] array)
Returns a compound border constructed from the given array of borders. |
static Border |
compound(Border outer,
Border inner)
Returns a compound border constructed from the given outer and inner borders. |
static Border |
empty()
Creates an empty border that takes up no space. |
static Border |
empty(int thickness)
Creates an empty border with the given thickness. |
static Border |
empty(int vgap,
int hgap)
Creates an empty border with the given gaps. |
static Border |
empty(int top,
int left,
int bottom,
int right)
Creates an empty border with the given parameters. |
static Border |
etchLowered()
Creates a default lowered etch border. |
static Border |
etchLowered(Color highlight,
Color shadow)
Creates a lowered etch border with the given highlight and shadow colors. |
static Border |
etchLowered(int levels,
Color highlight,
Color shadow)
Creates a lowered etch border in which the thickness of each color band is equal to the number of levels. |
static Border |
etchRaised()
Creates a default raised etch border. |
static Border |
etchRaised(Color highlight,
Color shadow)
Creates a raised etch border with the given highlight and shadow colors. |
static Border |
etchRaised(int levels,
Color highlight,
Color shadow)
Creates a raised etch border in which the thickness of each color band is equal to the number of levels. |
static Border |
line()
Creates a line border with color black and thickness 1. |
static Border |
line(Color color)
Creates a line border with given color and thickness 1. |
static Border |
line(Color color,
int thickness)
Creates a line border with the given color and thickness. |
static Border |
line(int thickness)
Creates a line border with color black and the given thickness. |
static Border |
matte(int thickness,
Color color)
Creates a matte border with the given thickness and color. |
static Border |
matte(int thickness,
Icon tileicon)
Creates a matte border with the given thickness and tileicon. |
static Border |
matte(int vgap,
int hgap,
Color color)
Creates a matte border with the given gaps and color. |
static Border |
matte(int vgap,
int hgap,
Icon tileicon)
Creates a matte border with the given gaps and tileicon. |
static Border |
matte(int top,
int left,
int bottom,
int right,
Color color)
Creates a matte border with the given parameters. |
static Border |
matte(int top,
int left,
int bottom,
int right,
Icon tileicon)
Creates a matte border with the given parameters. |
static Border |
sandwich(Border center,
Border wrap)
Returns a compound with the given center border in the middle and the wrap border as outer and inner. |
static TitledBorder |
title(String t)
Returns a TitledBorder using the given
parameters. |
static TitledBorder |
title(String t,
Border base)
Returns a TitledBorder using the given
parameters. |
static TitledBorder |
title(String t,
Border base,
Font font,
Color fontcolor)
Returns a TitledBorder using the given
parameters. |
static TitledBorder |
title(String t,
Font font,
Color fontcolor)
Returns a TitledBorder using the given
parameters. |
static TitledBorder |
title(String t,
int hPosition,
int vPosition)
Returns a TitledBorder using the given
parameters. |
static TitledBorder |
title(String t,
int hPosition,
int vPosition,
Border base)
Returns a TitledBorder using the given
parameters. |
static TitledBorder |
title(String t,
int hPosition,
int vPosition,
Border base,
Font font,
Color fontcolor)
Returns a TitledBorder using the given
parameters. |
static TitledBorder |
title(String t,
int hPosition,
int vPosition,
Font font,
Color fontcolor)
Returns a TitledBorder using the given
parameters. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int LEFT
TitledBorder.LEFT.
public static final int RIGHT
TitledBorder.RIGHT.
public static final int CENTER
TitledBorder.CENTER.
public static final int LEADING
TitledBorder.LEADING.
public static final int TRAILING
TitledBorder.TRAILING.
public static final int H_DEFAULT
CENTER) rather than
the Java default (LEADING).
public static final int TOP
TitledBorder.TOP.
public static final int ABOVE_TOP
TitledBorder.ABOVE_TOP.
public static final int BELOW_TOP
TitledBorder.BELOW_TOP.
public static final int BOTTOM
TitledBorder.BOTTOM.
public static final int ABOVE_BOTTOM
TitledBorder.ABOVE_BOTTOM.
public static final int BELOW_BOTTOM
TitledBorder.BELOW_BOTTOM.
public static final int V_DEFAULT
TOP) as in Java.
public static final Border DEFAULT_LINE_BORDER
line(Color.black,2).
| Constructor Detail |
private Borders()
| Method Detail |
public static Border empty()
Creates an empty border that takes up no space.
public static Border empty(int thickness)
Creates an empty border with the given thickness.
thickness - the border thickness
public static Border empty(int vgap,
int hgap)
Creates an empty border with the given gaps.
vgap - the border vertical gap: top and bottomhgap - the border horizontal gap: left and right
public static Border empty(int top,
int left,
int bottom,
int right)
Creates an empty border with the given parameters.
top - the border topleft - the border leftbottom - the border bottomright - the border right
public static Border matte(int thickness,
Color color)
Creates a matte border with the given thickness and color.
If the color is null, it is set to
the color Color.black.
thickness - the border thicknesscolor - the border color
public static Border matte(int vgap,
int hgap,
Color color)
Creates a matte border with the given gaps and color.
If the color is null, it is set to
the color Color.black.
vgap - the border vertical gap: top and bottomhgap - the border horizontal gap: left and rightcolor - the border color
public static Border matte(int top,
int left,
int bottom,
int right,
Color color)
Creates a matte border with the given parameters.
If the color is null, it is set to
the color Color.black.
top - the border topleft - the border leftbottom - the border bottomright - the border rightcolor - the border color
public static Border matte(int thickness,
Icon tileicon)
Creates a matte border with the given thickness and tileicon.
If the tileicon is null, it is replaced by
the color Color.black.
thickness - the border thicknesstileicon - the border tileicon
public static Border matte(int vgap,
int hgap,
Icon tileicon)
Creates a matte border with the given gaps and tileicon.
If the tileicon is null, it is replaced by
the color Color.black.
vgap - the border vertical gap: top and bottomhgap - the border horizontal gap: left and righttileicon - the border tileicon
public static Border matte(int top,
int left,
int bottom,
int right,
Icon tileicon)
Creates a matte border with the given parameters.
If the tileicon is null, it is replaced by
the color Color.black.
top - the border topleft - the border leftbottom - the border bottomright - the border righttileicon - the border tileiconpublic static Border line()
Creates a line border with color black and thickness 1.
public static Border line(Color color)
Creates a line border with given color and thickness 1.
If the color is null, it is set to
the color Color.black.
color - the border colorpublic static Border line(int thickness)
Creates a line border with color black and the given thickness.
thickness - the border thickness
public static Border line(Color color,
int thickness)
Creates a line border with the given color and thickness.
If the color is null, it is set to
the color Color.black.
Note that the effect of this method is the same as:
matte(thickness, color)
but the parameters are in the opposite order.
color - the border colorthickness - the border thicknesspublic static Border etchLowered()
Creates a default lowered etch border.
public static Border etchLowered(Color highlight,
Color shadow)
Creates a lowered etch border with the given highlight and shadow colors.
If either color is null,
returns a default lowered etch border.
highlight - the highlight colorshadow - the shadow color
public static Border etchLowered(int levels,
Color highlight,
Color shadow)
Creates a lowered etch border in which the thickness of each color band is equal to the number of levels.
Since each etch edge has 2 color bands, the thickness of each edge is 2*levels.
The north and west edges are set up as follows:
The south and east edges are set up as follows:
Note that these color settings are the opposite of those for a raised border.
It is an error if levels is not at least 1 or if either
color is null. In that case, a default
lowered etch border is returned.
levels - the number of levels in each color bandhighlight - the highlight colorshadow - the shadow colorpublic static Border etchRaised()
Creates a default raised etch border.
public static Border etchRaised(Color highlight,
Color shadow)
Creates a raised etch border with the given highlight and shadow colors.
If either color is null,
returns a default raised etch border.
highlight - the highlight colorshadow - the shadow color
public static Border etchRaised(int levels,
Color highlight,
Color shadow)
Creates a raised etch border in which the thickness of each color band is equal to the number of levels.
Since each etch edge has 2 color bands, the thickness of each edge is 2*levels.
The north and west edges are set up as follows:
The south and east edges are set up as follows:
Note that these color settings are the opposite of those for a lowered border.
It is an error if levels is not at least 1 or if either
color is null. In that case, a default
raised etch border is returned.
levels - the number of levels in each color bandhighlight - the highlight colorshadow - the shadow colorpublic static Border bevelLowered()
Creates a default lowered bevel border.
public static Border bevelLowered(Color highlight,
Color shadow)
Creates a lowered bevel border with the given highlight and shadow colors.
If either color is null,
returns a default lowered bevel border.
highlight - the highlight colorshadow - the shadow color
public static Border bevelLowered(Color highlightOuter,
Color highlightInner,
Color shadowInner,
Color shadowOuter)
Creates a lowered bevel border with the given outer and inner highlight colors and the given outer and inner shadow colors.
If any color is null,
returns a default lowered bevel border.
The parameter order outer-inner-inner-outer
is different from that used in the Java class
BorderFactory for similar methods.
highlightOuter - the outer highlight colorhighlightInner - the inner highlight colorshadowInner - the inner shadow colorshadowOuter - the outer shadow color
public static Border bevelLowered(int levels,
Color highlight,
Color shadow)
Creates a lowered bevel border in which the thickness of each edge is equal to the number of levels.
The north and west edges are set up as follows:
The south and east edges are set up as follows:
Note that these color settings are the opposite of those for a raised border.
It is an error if levels is not at least 1 or if either
color is null. In that case, a default
bevel border is returned.
levels - the thickness of each edgehighlight - the highlight colorshadow - the shadow color
public static Border bevelLowered(int levels,
Color highlightOuter,
Color highlightInner,
Color shadowInner,
Color shadowOuter)
Creates a lowered bevel border in which the thickness of each edge is equal to the number of levels.
The north and west edges are set up as follows:
The color smoothly interpolates from shadowOuter on the outside to shadowInner on the inside.
The south and east edges are set up as follows:
The color smoothly interpolates from highlightOuter on the outside to highlightInner on the inside.
Note that these color settings are the opposite of those for a raised border.
It is an error if levels is not at least 2 or if any
color is null. In that case, a default
bevel border is returned.
The parameter order outer-inner-inner-outer
is different from that used in the Java class
BorderFactory for similar methods.
levels - the thickness of each edgehighlightOuter - the outer highlight colorhighlightInner - the inner highlight colorshadowInner - the inner shadow colorshadowOuter - the outer shadow colorpublic static Border bevelRaised()
Creates a default raised bevel border.
public static Border bevelRaised(Color highlight,
Color shadow)
Creates a raised bevel border with the given highlight and shadow colors.
If either color is null,
returns a default raised bevel border.
highlight - the highlight colorshadow - the shadow color
public static Border bevelRaised(Color highlightOuter,
Color highlightInner,
Color shadowInner,
Color shadowOuter)
Creates a lowered bevel border with the given outer and inner highlight colors and the given outer and inner shadow colors.
If any color is null,
returns a default lowered bevel border.
The parameter order outer-inner-inner-outer
is different from that used in the Java class
BorderFactory for similar methods.
highlightOuter - the outer highlight colorhighlightInner - the inner highlight colorshadowInner - the inner shadow colorshadowOuter - the outer shadow color
public static Border bevelRaised(int levels,
Color highlight,
Color shadow)
Creates a raised bevel border in which the thickness of each edge is equal to the number of levels.
The north and west edges are set up as follows:
The south and east edges are set up as follows:
Note that these color settings are the opposite of those for a lowered border.
It is an error if levels is not at least 1 or if either
color is null. In that case, a default
bevel border is returned.
levels - the thickness of each edgehighlight - the highlight colorshadow - the shadow color
public static Border bevelRaised(int levels,
Color highlightOuter,
Color highlightInner,
Color shadowInner,
Color shadowOuter)
Creates a raised bevel border in which the thickness of each edge is equal to the number of levels.
The north and west edges are set up as follows:
The color smoothly interpolates from highlightOuter on the outside to highlightInner on the inside.
The south and east edges are set up as follows:
The color smoothly interpolates from shadowOuter on the outside to shadowInner on the inside.
Note that these color settings are the opposite of those for a lowered border.
It is an error if levels is not at least 2 or if any
color is null. In that case, a default
bevel border is returned.
The parameter order outer-inner-inner-outer
is different from that used in the Java class
BorderFactory for similar methods.
levels - the thickness of each edgehighlightOuter - the outer highlight colorhighlightInner - the inner highlight colorshadowInner - the inner shadow colorshadowOuter - the outer shadow colorpublic static TitledBorder title(String t)
Returns a TitledBorder using the given
parameters.
If t is null,
it is set to an empty string.
The title is centered in the top position.
A title is inserted into an existing border. This constructor uses a default line border of thickness 2 in black.
t - the title string
public static TitledBorder title(String t,
Border base)
Returns a TitledBorder using the given
parameters.
If t is null,
it is set to an empty string.
The title is centered in the top position.
A title is inserted into an existing border. If the
base is non-null that border is
used; otherwise a default line border is used. We have
changed the default line border to a line border of
thickness 2 in black. The Java default is of thickness 1
and is in a pale blue that is almost invisible.
t - the title stringbase - the base border in which to place the title
public static TitledBorder title(String t,
Font font,
Color fontcolor)
Returns a TitledBorder using the given
parameters.
If t is null,
it is set to an empty string.
The title is centered in the top position.
A title is inserted into an existing border. This constructor uses a default line border of thickness 2 in black.
The font and fontcolor may be
supplied or left as null to accept defaults.
t - the title stringfont - the title fontfontcolor - the title font color
public static TitledBorder title(String t,
Border base,
Font font,
Color fontcolor)
Returns a TitledBorder using the given
parameters.
If t is null,
it is set to an empty string.
The title is centered in the top position.
A title is inserted into an existing border. If the
base is non-null that border is
used; otherwise a default line border is used. We have
changed the default line border to a line border of
thickness 2 in black. The Java default is of thickness 1
and is in a pale blue that is almost invisible.
The font and fontcolor may be
supplied or left as null to accept defaults.
t - the title stringbase - the base border in which to place the titlefont - the title fontfontcolor - the title font color
public static TitledBorder title(String t,
int hPosition,
int vPosition)
Returns a TitledBorder using the given
parameters.
If t is null,
it is set to an empty string.
The valid values for hPosition are:
LEFTRIGHTCENTERLEADINGTRAILINGH_DEFAULT (CENTER)The valid values for vPosition are:
TOPABOVE_TOPBELOW_TOPBOTTOMABOVE_BOTTOMBELOW_BOTTOMV_DEFAULT (TOP)If either hPosition or vPosition
are invalid, they are set to the corresponding default.
The constants listed above are defined in the Java class
TitledBorder except for the default constants.
All constants are redefined in this class and the defaults
are added as specified above.
A title is inserted into an existing border. This constructor uses a default line border of thickness 2 in black.
t - the title stringhPosition - the horizontal positionvPosition - the vertical position
public static TitledBorder title(String t,
int hPosition,
int vPosition,
Border base)
Returns a TitledBorder using the given
parameters.
If t is null,
it is set to an empty string.
The valid values for hPosition are:
LEFTRIGHTCENTERLEADINGTRAILINGH_DEFAULT (CENTER)The valid values for vPosition are:
TOPABOVE_TOPBELOW_TOPBOTTOMABOVE_BOTTOMBELOW_BOTTOMV_DEFAULT (TOP)If either hPosition or vPosition
are invalid, they are set to the corresponding default.
The constants listed above are defined in the Java class
TitledBorder except for the default constants.
All constants are redefined in this class and the defaults
are added as specified above.
A title is inserted into an existing border. If the
base is non-null that border is
used; otherwise a default line border is used. We have
changed the default line border to a line border of
thickness 2 in black. The Java default is of thickness 1
and is in a pale blue that is almost invisible.
t - the title stringhPosition - the horizontal positionvPosition - the vertical positionbase - the base border in which to place the title
public static TitledBorder title(String t,
int hPosition,
int vPosition,
Font font,
Color fontcolor)
Returns a TitledBorder using the given
parameters.
If t is null,
it is set to an empty string.
The valid values for hPosition are:
LEFTRIGHTCENTERLEADINGTRAILINGH_DEFAULT (CENTER)The valid values for vPosition are:
TOPABOVE_TOPBELOW_TOPBOTTOMABOVE_BOTTOMBELOW_BOTTOMV_DEFAULT (TOP)If either hPosition or vPosition
are invalid, they are set to the corresponding default.
The constants listed above are defined in the Java class
TitledBorder except for the default constants.
All constants are redefined in this class and the defaults
are added as specified above.
A title is inserted into an existing border. This constructor uses a default line border of thickness 2 in black.
The font and fontcolor may be
supplied or left as null to accept defaults.
t - the title stringhPosition - the horizontal positionvPosition - the vertical positionfont - the title fontfontcolor - the title font color
public static TitledBorder title(String t,
int hPosition,
int vPosition,
Border base,
Font font,
Color fontcolor)
Returns a TitledBorder using the given
parameters.
If t is null,
it is set to an empty string.
The valid values for hPosition are:
LEFTRIGHTCENTERLEADINGTRAILINGH_DEFAULT (CENTER)The valid values for vPosition are:
TOPABOVE_TOPBELOW_TOPBOTTOMABOVE_BOTTOMBELOW_BOTTOMV_DEFAULT (TOP)If either hPosition or vPosition
are invalid, they are set to the corresponding default.
The constants listed above are defined in the Java class
TitledBorder except for the default constants.
All constants are redefined in this class and the defaults
are added as specified above.
A title is inserted into an existing border. If the
base is non-null that border is
used; otherwise a default line border is used. We have
changed the default line border to a line border of
thickness 2 in black. The Java default is of thickness 1
and is in a pale blue that is almost invisible.
The font and fontcolor may be
supplied or left as null to accept defaults.
t - the title stringhPosition - the horizontal positionvPosition - the vertical positionbase - the base border in which to place the titlefont - the title fontfontcolor - the title font color
public static Border compound(Border outer,
Border inner)
Returns a compound border constructed from the given outer and inner borders.
If either border is null, the other
border is returned directly.
outer - the outer borderinner - the inner borderpublic static Border compound(Border[] array)
Returns a compound border constructed from the given array of borders.
The initial border in the array will be the outermost border in the compound.
The sequence of array elements is viewed as outermost to innermost.
array - an array of borders to compound
public static Border sandwich(Border center,
Border wrap)
Returns a compound with the given center border in the middle and the wrap border as outer and inner.
center - the border in the middlewrap - the border to wrap as both outer and inner
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||