JavaTM 2 Platform
Standard Ed. 5.0

javax.swing.border
Class TitledBorder

java.lang.Object
  extended by javax.swing.border.AbstractBorder
      extended by javax.swing.border.TitledBorder
All Implemented Interfaces:
Serializable, Border
Direct Known Subclasses:
BorderUIResource.TitledBorderUIResource

public class TitledBorder
extends AbstractBorder

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.


Field Summary
static int ABOVE_BOTTOM
          Position the title above the border's bottom line.
static int ABOVE_TOP
          Position the title above the border's top line.
static int BELOW_BOTTOM
          Position the title below the border's bottom line.
static int BELOW_TOP
          Position the title below the border's top line.
protected  Border border
           
static int BOTTOM
          Position the title in the middle of the border's bottom line.
static int CENTER
          Position title text in the center of the border line.
static int DEFAULT_JUSTIFICATION
          Use the default justification for the title text.
static int DEFAULT_POSITION
          Use the default vertical orientation for the title text.
protected static int EDGE_SPACING
           
static 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.
static int LEFT
          Position title text at the left side of the border line.
static int RIGHT
          Position title text at the right side of the border line.
protected static int TEXT_INSET_H
           
protected static int TEXT_SPACING
           
protected  String title
           
protected  Color titleColor
           
protected  Font titleFont
           
protected  int titleJustification
           
protected  int titlePosition
           
static int TOP
          Position the title in the middle of the border's top line.
static 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.
 
Constructor Summary
TitledBorder(Border border)
          Creates a TitledBorder instance with the specified border and an empty title.
TitledBorder(Border border, String title)
          Creates a TitledBorder instance with the specified border and title.
TitledBorder(Border border, String title, int titleJustification, int titlePosition)
          Creates a TitledBorder instance with the specified border, title, title-justification, and title-position.
TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont)
          Creates a TitledBorder instance with the specified border, title, title-justification, title-position, and title-font.
TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor)
          Creates a TitledBorder instance with the specified border, title, title-justification, title-position, title-font, and title-color.
TitledBorder(String title)
          Creates a TitledBorder instance.
 
Method Summary
 Border getBorder()
          Returns the border of the titled border.
 Insets getBorderInsets(Component c)
          Returns the insets of the border.
 Insets getBorderInsets(Component c,