| Border |
|
typedict |
| |
A
Border
holds information used to construct borders around Swing components.
Even though any border can be constructed using
Border,
applications that create borders usually let the
border
field defined in Swing components build it from simple types, like a
String
or
Number,
or they combine one or more of the
BevelBorder,
EmptyBorder,
EtchedBorder,
LineBorder,
MatteBorder,
or
SoftBevelBorder
types to create more complicated borders.
The fields in a
Border
are:
| alignment |
An
int
that controls the horizontal positioning of the text in a border when it is
supplied via the
title
field.
The value can be
LEFT
(the default),
WEST,
LEADING,
CENTER,
RIGHT,
EAST,
or
TRAILING,
which are all defined in
yoix.swing.
| | background |
The
Color
that is used to paint the primary border feature, if there is one.
For example,
background
is the color used when a
LineBorder
draws a line around a component;
it can also be used to derive the
highlight
or
shadow
colors that are used by a
BevelBorder,
SoftBevelBorder,
or
EtchedBorder.
A
NULL
value, which is the default, means use the background color of the
component that is being outlined by the border.
| | child |
A
Border
that will be enclosed by this border.
A child border can, in turn, have its own child border, which provides
a mechanism for constructing a complex borders consisting of several
border types.
| | font |
The
Font,
or font name if it is a
String,
used to paint the characters stored in the
title
field.
A
NULL
value, which is the default, means use the font specified by the
TitledBorder.font
property of the current look and feel, which is a value that can be
accessed or changed using a
UIManager
object.
| | foreground |
The
Color
used to paint the border title, if there is one.
A
NULL
value, which is the default, means use the color specified by the
TitledBorder.titleColor
property of the current look and feel, which is a value that can be
accessed or changed using a
UIManager
object.
| | highlight |
The
Color
used when a
BevelBorder,
SoftBevelBorder,
or
EtchedBorder
to draws the parts of the border that constitute the highlight.
When
highlight
is
NULL
background
is used to derive the color.
| | icon |
An
Image
that tiles the area described by
insets
when a
MatteBorder
is drawn.
If
insets
is
NULL
the dimensions of the image itself determine the size of the
MatteBorder.
When
icon
is
NULL
a
MatteBorder
fills the the area described by
insets
with the
background
color.
| | insets |
An
Object,
usually an
Insets
or
Number,
that describes the margins, in units of 72 dots per inch, that a
MatteBorder
or
EmptyBorder
leaves around the top, left, bottom, and right sides of a component.
An
insets
that is a number is an easy way to describe a uniform margin.
| | position |
An
int
that controls the vertical positioning of the text in a border when it is
supplied via the
title
field.
Like
alignment,
only applies when a
title
is present.
The value can be
ABOVE_TOP,
TOP
(the default),
NORTH,
BELOW_TOP,
ABOVE_BOTTOM,
BOTTOM,
SOUTH,
or
BELOW_BOTTOM,
which are all defined in
yoix.swing.
| | raised |
An
int
that should be
1
when the border drawn around a component by a
BevelBorder,
SoftBevelBorder,
or
EtchedBorder
appears to be raised, and
0
(the default)
when it appears to be lowered.
| | rounded |
An
int
that is
1
when the border drawn around a component by a
LineBorder
has rounded corners and
0
(the default)
when it does not.
| | shadow |
The
Color
used when a
BevelBorder,
SoftBevelBorder,
or
EtchedBorder
to draws the parts of the border that constitute the shadow.
When
shadow
is
NULL
background
is used to derive the color.
| | thickness |
A
double
that specifies the thickness, in units of 72 dots per inch,
of the solid line drawn around a component by a
LineBorder.
| | title |
A
String
that is incorporated into the border and placed according to the
alignment
and
position
fields.
The
font
and
foreground
fields can be used to override default values,
which are selected by the current look and feel.
| | type |
An
int
that identifies the type of the border.
The value should be one of
BEVELED,
EMPTY,
ETCHED
(the default),
LINED,
MATTE,
or
SOFTBEVELED,
which are all defined in
yoix.swing.
| | width |
Older Yoix versions defined this field, but its use is not recommended,
it will not be documented, and support for
width
may be removed in a future release.
|
Changing the fields in a
Border
object that has already been assigned to a Swing component does not
change the component's appearance, however storing a new value in
that component's
border
field does.
| |
| Example: |
The program,
import yoix.*.*;
JFrame f = {
Dimension size = NULL;
Array layout = {
new JButton {
String text = "Quit";
MatteBorder border = {
Color background = Color.green;
int insets = 9;
EtchedBorder child = {
String title = "Button";
Color foreground = Color.red;
int raised = TRUE;
EmptyBorder child = {
int insets = 9;
BevelBorder child = {
int raised = TRUE;
EmptyBorder child = {
int insets = 9;
};
};
};
};
};
actionPerformed(e) {
exit(0);
}
},
};
};
f.visible = TRUE;
fills a small frame with a quit button contained within several borders.
| | |
| See Also: |
BevelBorder,
EmptyBorder,
EtchedBorder,
JButton,
JCanvas,
JCheckBox,
JFileChooser,
JLabel,
JList,
JMenu,
JMenuBar,
JMenuItem,
JPanel,
JPopupMenu,
JProgressBar,
JScrollBar,
JScrollPane,
JSlider,
JSplitPane,
JTabbedPane,
JTable,
JTextArea,
JTextCanvas,
JTextField,
JTextField,
JTextPane,
JTextTerm,
JTree,
LineBorder,
MatteBorder,
SoftBevelBorder,
UIManager
|
|
Yoix is a registered trademark of AT&T Inc.
|
|