java.lang.Object | ||
↳ | javax.swing.border.AbstractBorder | |
↳ | javax.swing.border.TitledBorder |
![]() |
A class which implements an arbitrary border with the addition of a String title in a specified position and justification.
If the border, font, or color property values are not specified in the constuctor or by invoking the appropriate set methods, the property values will be defined by the current look and feel, using the following property names in the Defaults Table:
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see XMLEncoder
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | ABOVE_BOTTOM | Position the title above the border's bottom line. | |||||||||
int | ABOVE_TOP | Position the title above the border's top line. | |||||||||
int | BELOW_BOTTOM | Position the title below the border's bottom line. | |||||||||
int | BELOW_TOP | Position the title below the border's top line. | |||||||||
int | BOTTOM | Position the title in the middle of the border's bottom line. | |||||||||
int | CENTER | Position title text in the center of the border line. | |||||||||
int | DEFAULT_JUSTIFICATION | Use the default justification for the title text. | |||||||||
int | DEFAULT_POSITION | Use the default vertical orientation for the title text. | |||||||||
int | EDGE_SPACING | ||||||||||
int | LEADING | Position title text at the left side of the border line for left to right orientation, at the right side of the border line for right to left orientation. | |||||||||
int | LEFT | Position title text at the left side of the border line. | |||||||||
int | RIGHT | Position title text at the right side of the border line. | |||||||||
int | TEXT_INSET_H | ||||||||||
int | TEXT_SPACING | ||||||||||
int | TOP | Position the title in the middle of the border's top line. | |||||||||
int | TRAILING | Position title text at the right side of the border line for left to right orientation, at the left side of the border line for right to left orientation. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
border | |||||||||||
title | |||||||||||
titleColor | |||||||||||
titleFont | |||||||||||
titleJustification | |||||||||||
titlePosition |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a TitledBorder instance.
| |||||||||||
Creates a TitledBorder instance with the specified border
and an empty title.
| |||||||||||
Creates a TitledBorder instance with the specified border
and title.
| |||||||||||
Creates a TitledBorder instance with the specified border,
title, title-justification, and title-position.
| |||||||||||
Creates a TitledBorder instance with the specified border,
title, title-justification, title-position, and title-font.
| |||||||||||
Creates a TitledBorder instance with the specified border,
title, title-justification, title-position, title-font, and
title-color.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the baseline.
| |||||||||||
Returns an enum indicating how the baseline of the border
changes as the size changes.
| |||||||||||
Returns the border of the titled border.
| |||||||||||
Reinitialize the insets parameter with this Border's current Insets.
| |||||||||||
Returns the insets of the border.
| |||||||||||
Returns the minimum dimensions this border requires
in order to fully display the border and title.
| |||||||||||
Returns the title of the titled border.
| |||||||||||
Returns the title-color of the titled border.
| |||||||||||
Returns the title-font of the titled border.
| |||||||||||
Returns the title-justification of the titled border.
| |||||||||||
Returns the title-position of the titled border.
| |||||||||||
Returns whether or not the border is opaque.
| |||||||||||
Paints the border for the specified component with the
specified position and size.
| |||||||||||
Sets the border of the titled border.
| |||||||||||
Sets the title of the titled border.
| |||||||||||
Sets the title-color of the titled border.
| |||||||||||
Sets the title-font of the titled border.
| |||||||||||
Sets the title-justification of the titled border.
| |||||||||||
Sets the title-position of the titled border.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Position the title above the border's bottom line.
Position the title above the border's top line.
Position the title below the border's bottom line.
Position the title below the border's top line.
Position the title in the middle of the border's bottom line.
Position title text in the center of the border line.
Use the default justification for the title text.
Use the default vertical orientation for the title text.
Position title text at the left side of the border line for left to right orientation, at the right side of the border line for right to left orientation.
Position title text at the left side of the border line.
Position title text at the right side of the border line.
Position the title in the middle of the border's top line.
Position title text at the right side of the border line for left to right orientation, at the left side of the border line for right to left orientation.
Creates a TitledBorder instance.
title | the title the border should display |
---|
Creates a TitledBorder instance with the specified border and an empty title.
border | the border |
---|
Creates a TitledBorder instance with the specified border and title.
border | the border |
---|---|
title | the title the border should display |
Creates a TitledBorder instance with the specified border, title, title-justification, and title-position.
border | the border |
---|---|
title | the title the border should display |
titleJustification | the justification for the title |
titlePosition | the position for the title |
Creates a TitledBorder instance with the specified border, title, title-justification, title-position, and title-font.
border | the border |
---|---|
title | the title the border should display |
titleJustification | the justification for the title |
titlePosition | the position for the title |
titleFont | the font for rendering the title |
Creates a TitledBorder instance with the specified border, title, title-justification, title-position, title-font, and title-color.
border | the border |
---|---|
title | the title the border should display |
titleJustification | the justification for the title |
titlePosition | the position for the title |
titleFont | the font of the title |
titleColor | the color of the title |
Returns the baseline.
c | Component baseline is being requested for |
---|---|
width | the width to get the baseline for |
height | the height to get the baseline for |
Returns an enum indicating how the baseline of the border changes as the size changes.
c | Component to return baseline resize behavior for |
---|
NullPointerException |
---|
Reinitialize the insets parameter with this Border's current Insets.
c | the component for which this border insets value applies |
---|---|
insets | the object to be reinitialized |
insets
object
Returns the insets of the border.
c | the component for which this border insets value applies |
---|
Insets
object initialized to 0
Returns the minimum dimensions this border requires in order to fully display the border and title.
c | the component where this border will be drawn |
---|
Returns the title-justification of the titled border.
Returns the title-position of the titled border.
Returns whether or not the border is opaque.
Paints the border for the specified component with the specified position and size.
c | the component for which this border is being painted |
---|---|
g | the paint graphics |
x | the x position of the painted border |
y | the y position of the painted border |
width | the width of the painted border |
height | the height of the painted border |
Sets the border of the titled border.
border | the border |
---|
Sets the title of the titled border. param title the title for the border
Sets the title-color of the titled border.
titleColor | the color for the border title |
---|
Sets the title-font of the titled border.
titleFont | the font for the border title |
---|
Sets the title-justification of the titled border.
titleJustification | the justification for the border |
---|
Sets the title-position of the titled border.
titlePosition | the position for the border |
---|