java.lang.Object
javax.swing.border.AbstractBorder
javax.swing.border.TitledBorder
- すべての実装されたインタフェース:
- Serializable,- Border
- 直系の既知のサブクラス:
- BorderUIResource.TitledBorderUIResource
public class TitledBorder extends AbstractBorder
Stringによるタイトルを位置および位置揃えを指定して追加し、任意のボーダーを実装するクラスです。
 
ボーダー、フォント、カラーのプロパティ値が、コンストラクタ内で、または適切なsetメソッドの呼出しによって指定されていない場合は、Defaults Tableにある次のプロパティ名を使用して現在のLook & Feelでプロパティ値を定義します。
- "TitledBorder.border"
- "TitledBorder.font"
- "TitledBorder.titleColor"
 警告: このクラスの直列化されたオブジェクトは、今後のSwingリリースと互換ではなくなる予定です。 現在の直列化のサポートは、短期間の格納や、同じバージョンのSwingを実行するアプリケーション間のRMIに適しています。 1.4以降、すべてのJavaBeans™用の長期間の格納サポートがjava.beansパッケージに追加されています。 XMLEncoderを参照してください。 
- 
フィールドのサマリーフィールド 修飾子と型 フィールド 説明 static intABOVE_BOTTOMタイトルをボーダーのボトム・ラインより上に配置します。static intABOVE_TOPタイトルをボーダーのトップ・ラインより上に配置します。static intBELOW_BOTTOMタイトルをボーダーのボトム・ラインより下に配置します。static intBELOW_TOPタイトルをボーダーのトップ・ラインより下に配置します。protected Borderborderボーダー。static intBOTTOMタイトルをボーダーのボトム・ラインの中央に配置します。static intCENTERタイトル・テキストをボーダー・ラインの中央に配置します。static intDEFAULT_JUSTIFICATIONタイトル・テキストにデフォルトの位置揃えを使用します。static intDEFAULT_POSITIONタイトル・テキストにデフォルトの垂直方向配置を使用します。protected static intEDGE_SPACINGボーダーとコンポーネント・エッジの間のスペースstatic intLEADING左から右方向の場合はタイトル・テキストをボーダー・ラインの左側に、右から左方向の場合はボーダー・ラインの右側に配置します。static intLEFTタイトル・テキストをボーダー・ラインの左側に配置します。static intRIGHTタイトル・テキストをボーダー・ラインの右側に配置します。protected static intTEXT_INSET_H左揃えまたは右揃えのテキストの水平インセットprotected static intTEXT_SPACINGボーダーとテキストの間のスペースprotected Stringtitleボーダーが表示するタイトル。protected ColortitleColorタイトルの色。protected FonttitleFontタイトルを描画するためのフォント。protected inttitleJustificationタイトルの正当性。protected inttitlePositionタイトルの位置。static intTOPタイトルをボーダーのトップ・ラインの中央に配置します。static intTRAILING左から右方向の場合はタイトル・テキストをボーダー・ラインの右側に、右から左方向の場合はボーダー・ラインの左側に配置します。
- 
コンストラクタのサマリーコンストラクタ コンストラクタ 説明 TitledBorder(String title)TitledBorderインスタンスを作成します。TitledBorder(Border border)指定されたボーダーと空のタイトルで、TitledBorderのインスタンスを生成します。TitledBorder(Border border, String title)指定されたボーダーでTitledBorderのインスタンスを生成します。TitledBorder(Border border, String title, int titleJustification, int titlePosition)指定されたボーダー、タイトル、タイトルの位置揃え、およびタイトルの配置で、TitledBorderのインスタンスを生成します。TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont)指定されたボーダー、タイトル、タイトル位置揃え、タイトル位置、およびタイトル・フォントで、TitledBorderのインスタンスを生成します。TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor)指定されたボーダー、タイトル、タイトル位置揃え、タイトル位置、タイトル・フォント、およびタイトル・カラーで、TitledBorderのインスタンスを生成します。
- 
メソッドのサマリー修飾子と型 メソッド 説明 intgetBaseline(Component c, int width, int height)ベースラインを返します。Component.BaselineResizeBehaviorgetBaselineResizeBehavior(Component c)サイズの変化に合わせてボーダーのベースラインがどのように変化するかを示す列挙を返します。BordergetBorder()タイトル付きボーダーのボーダーを返します。InsetsgetBorderInsets(Component c, Insets insets)insetsパラメータを、このBorderの現在のInsetsで初期化し直します。protected FontgetFont(Component c)タイトル付きボーダーのデフォルト・フォントを返します。DimensiongetMinimumSize(Component c)ボーダーとタイトルを完全に表示するためにボーダーに必要な最小サイズを返します。StringgetTitle()タイトル付きボーダーのタイトルを返します。ColorgetTitleColor()タイトル付きボーダーのタイトル・カラーを返します。FontgetTitleFont()タイトル付きボーダーのタイトル・フォントを返します。intgetTitleJustification()タイトル付きボーダーのタイトル位置揃えを返します。intgetTitlePosition()タイトル付きボーダーのタイトル位置を返します。booleanisBorderOpaque()ボーダーが不透明かどうかを返します。voidpaintBorder(Component c, Graphics g, int x, int y, int width, int height)指定されたコンポーネントのボーダーを、指定された位置およびサイズでペイントします。voidsetBorder(Border border)タイトル付きボーダーのボーダーを設定します。voidsetTitle(String title)タイトル付きボーダーのタイトルを設定します。voidsetTitleColor(Color titleColor)タイトル付きボーダーのタイトル・カラーを設定します。voidsetTitleFont(Font titleFont)タイトル付きボーダーのタイトル・フォントを設定します。voidsetTitleJustification(int titleJustification)タイトル付きボーダーのタイトル位置揃えを設定します。voidsetTitlePosition(int titlePosition)タイトル付きボーダーのタイトル位置を設定します。クラス javax.swing.border.AbstractBorderで宣言されたメソッドgetBorderInsets, getInteriorRectangle, getInteriorRectangle
- 
フィールド詳細- 
titleprotected String titleボーダーが表示するタイトル。
- 
borderprotected Border borderボーダー。
- 
titlePositionprotected int titlePositionタイトルの位置。
- 
titleJustificationprotected int titleJustificationタイトルの正当性。
- 
titleFontprotected Font titleFontタイトルを描画するためのフォント。
- 
titleColorprotected Color titleColorタイトルの色。
- 
DEFAULT_POSITIONpublic static final int DEFAULT_POSITIONタイトル・テキストにデフォルトの垂直方向配置を使用します。- 関連項目:
- 定数フィールド値
 
- 
ABOVE_TOPpublic static final int ABOVE_TOPタイトルをボーダーのトップ・ラインより上に配置します。- 関連項目:
- 定数フィールド値
 
- 
TOPpublic static final int TOPタイトルをボーダーのトップ・ラインの中央に配置します。- 関連項目:
- 定数フィールド値
 
- 
BELOW_TOPpublic static final int BELOW_TOPタイトルをボーダーのトップ・ラインより下に配置します。- 関連項目:
- 定数フィールド値
 
- 
ABOVE_BOTTOMpublic static final int ABOVE_BOTTOMタイトルをボーダーのボトム・ラインより上に配置します。- 関連項目:
- 定数フィールド値
 
- 
BOTTOMpublic static final int BOTTOMタイトルをボーダーのボトム・ラインの中央に配置します。- 関連項目:
- 定数フィールド値
 
- 
BELOW_BOTTOMpublic static final int BELOW_BOTTOMタイトルをボーダーのボトム・ラインより下に配置します。- 関連項目:
- 定数フィールド値
 
- 
DEFAULT_JUSTIFICATIONpublic static final int DEFAULT_JUSTIFICATIONタイトル・テキストにデフォルトの位置揃えを使用します。- 関連項目:
- 定数フィールド値
 
- 
LEFTpublic static final int LEFTタイトル・テキストをボーダー・ラインの左側に配置します。- 関連項目:
- 定数フィールド値
 
- 
CENTERpublic static final int CENTERタイトル・テキストをボーダー・ラインの中央に配置します。- 関連項目:
- 定数フィールド値
 
- 
RIGHTpublic static final int RIGHTタイトル・テキストをボーダー・ラインの右側に配置します。- 関連項目:
- 定数フィールド値
 
- 
LEADINGpublic static final int LEADING左から右方向の場合はタイトル・テキストをボーダー・ラインの左側に、右から左方向の場合はボーダー・ラインの右側に配置します。- 関連項目:
- 定数フィールド値
 
- 
TRAILINGpublic static final int TRAILING左から右方向の場合はタイトル・テキストをボーダー・ラインの右側に、右から左方向の場合はボーダー・ラインの左側に配置します。- 関連項目:
- 定数フィールド値
 
- 
EDGE_SPACINGprotected static final int EDGE_SPACINGボーダーとコンポーネント・エッジの間のスペース- 関連項目:
- 定数フィールド値
 
- 
TEXT_SPACINGprotected static final int TEXT_SPACINGボーダーとテキストの間のスペース- 関連項目:
- 定数フィールド値
 
- 
TEXT_INSET_Hprotected static final int TEXT_INSET_H左揃えまたは右揃えのテキストの水平インセット- 関連項目:
- 定数フィールド値
 
 
- 
- 
コンストラクタの詳細- 
TitledBorderpublic TitledBorder(String title)TitledBorderインスタンスを作成します。- パラメータ:
- title- ボーダーに表示するタイトル
 
- 
TitledBorderpublic TitledBorder(Border border)指定されたボーダーと空のタイトルで、TitledBorderのインスタンスを生成します。- パラメータ:
- border- ボーダー
 
- 
TitledBorder指定されたボーダーでTitledBorderのインスタンスを生成します。- パラメータ:
- border- ボーダー
- title- ボーダーに表示するタイトル
 
- 
TitledBorder指定されたボーダー、タイトル、タイトルの位置揃え、およびタイトルの配置で、TitledBorderのインスタンスを生成します。- パラメータ:
- border- ボーダー
- title- ボーダーに表示するタイトル
- titleJustification- タイトルの位置揃え
- titlePosition- タイトルの位置
 
- 
TitledBorderpublic TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont)指定されたボーダー、タイトル、タイトル位置揃え、タイトル位置、およびタイトル・フォントで、TitledBorderのインスタンスを生成します。- パラメータ:
- border- ボーダー
- title- ボーダーに表示するタイトル
- titleJustification- タイトルの位置揃え
- titlePosition- タイトルの位置
- titleFont- タイトルを描画するフォント
 
- 
TitledBorder@ConstructorProperties({"border","title","titleJustification","titlePosition","titleFont","titleColor"})public TitledBorder(Border border, String title, int titleJustification, int titlePosition, Font titleFont, Color titleColor)指定されたボーダー、タイトル、タイトル位置揃え、タイトル位置、タイトル・フォント、およびタイトル・カラーで、TitledBorderのインスタンスを生成します。- パラメータ:
- border- ボーダー
- title- ボーダーに表示するタイトル
- titleJustification- タイトルの位置揃え
- titlePosition- タイトルの位置
- titleFont- タイトルのフォント
- titleColor- タイトルのカラー
 
 
- 
- 
メソッドの詳細- 
paintBorder指定されたコンポーネントのボーダーを、指定された位置およびサイズでペイントします。- 定義:
- paintBorder、インタフェース:- Border
- オーバーライド:
- paintBorder、クラス:- AbstractBorder
- パラメータ:
- c- このボーダーがペイントされるコンポーネント
- g- ペイント・グラフィックス
- x- ペイントされるボーダーのx座標
- y- ペイントされるボーダーのy座標
- width- ペイントされるボーダーの幅
- height- ペイントされるボーダーの高さ
 
- 
getBorderInsetsinsetsパラメータを、このBorderの現在のInsetsで初期化し直します。- オーバーライド:
- getBorderInsets、クラス:- AbstractBorder
- パラメータ:
- c- このボーダーのイン・セットの値を適用するコンポーネント
- insets- 初期化し直されるオブジェクト
- 戻り値:
- insetsオブジェクト
 
- 
isBorderOpaquepublic boolean isBorderOpaque()ボーダーが不透明かどうかを返します。- 定義:
- isBorderOpaque、インタフェース:- Border
- オーバーライド:
- isBorderOpaque、クラス:- AbstractBorder
- 戻り値:
- false
 
- 
getTitlepublic String getTitle()タイトル付きボーダーのタイトルを返します。- 戻り値:
- タイトル付きボーダーのタイトル
 
- 
getBorderpublic Border getBorder()タイトル付きボーダーのボーダーを返します。- 戻り値:
- タイトル付きボーダーのボーダー
 
- 
getTitlePositionpublic int getTitlePosition()タイトル付きボーダーのタイトル位置を返します。- 戻り値:
- タイトル付きボーダーのタイトル位置
 
- 
getTitleJustificationpublic int getTitleJustification()タイトル付きボーダーのタイトル位置揃えを返します。- 戻り値:
- タイトル付きボーダーのタイトル位置揃え
 
- 
getTitleFontpublic Font getTitleFont()タイトル付きボーダーのタイトル・フォントを返します。- 戻り値:
- タイトル付きボーダーのタイトル・フォント
 
- 
getTitleColorpublic Color getTitleColor()タイトル付きボーダーのタイトル・カラーを返します。- 戻り値:
- タイトル付きボーダーのタイトル・カラー
 
- 
setTitlepublic void setTitle(String title)タイトル付きボーダーのタイトルを設定します。- パラメータ:
- title- ボーダーのタイトル
 
- 
setBorderpublic void setBorder(Border border)タイトル付きボーダーのボーダーを設定します。- パラメータ:
- border- ボーダー
 
- 
setTitlePositionpublic void setTitlePosition(int titlePosition)タイトル付きボーダーのタイトル位置を設定します。- パラメータ:
- titlePosition- ボーダーの位置
 
- 
setTitleJustificationpublic void setTitleJustification(int titleJustification)タイトル付きボーダーのタイトル位置揃えを設定します。- パラメータ:
- titleJustification- ボーダーの位置揃え
 
- 
setTitleFontpublic void setTitleFont(Font titleFont)タイトル付きボーダーのタイトル・フォントを設定します。- パラメータ:
- titleFont- ボーダー・タイトルのフォント
 
- 
setTitleColorpublic void setTitleColor(Color titleColor)タイトル付きボーダーのタイトル・カラーを設定します。- パラメータ:
- titleColor- ボーダー・タイトルのカラー
 
- 
getMinimumSizeボーダーとタイトルを完全に表示するためにボーダーに必要な最小サイズを返します。- パラメータ:
- c- このボーダーが描画されるコンポーネント
- 戻り値:
- Dimensionオブジェクト
 
- 
getBaselinepublic int getBaseline(Component c, int width, int height)ベースラインを返します。- オーバーライド:
- getBaseline、クラス:- AbstractBorder
- パラメータ:
- c- 要求される- Componentベースライン
- width- ベースラインを取得する幅
- height- ベースラインを取得する高さ
- 戻り値:
- ベースラインまたは0より小さい値(適切なベースラインがないことを示す)
- 例外:
- NullPointerException
- IllegalArgumentException- 幅または高さが0より小さい場合
- 導入されたバージョン:
- 1.6
- 関連項目:
- JComponent.getBaseline(int, int)
 
- 
getBaselineResizeBehaviorpublic Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c)サイズの変化に合わせてボーダーのベースラインがどのように変化するかを示す列挙を返します。- オーバーライド:
- getBaselineResizeBehavior、クラス:- AbstractBorder
- パラメータ:
- c- ベースラインのサイズ変更の動作を返す- Component
- 戻り値:
- ボーダーのサイズ変更に伴うベースラインの変化を示す列挙
- 例外:
- NullPointerException
- 導入されたバージョン:
- 1.6
- 関連項目:
- JComponent.getBaseline(int, int)
 
- 
getFontタイトル付きボーダーのデフォルト・フォントを返します。- パラメータ:
- c- コンポーネント
- 戻り値:
- タイトル付きボーダーのデフォルト・フォント
 
 
-