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 final int
タイトルをボーダーのボトム・ラインより上に配置します。static final int
タイトルをボーダーのトップ・ラインより上に配置します。static final int
タイトルをボーダーのボトム・ラインより下に配置します。static final int
タイトルをボーダーのトップ・ラインより下に配置します。protected Border
ボーダー。static final int
タイトルをボーダーのボトム・ラインの中央に配置します。static final int
タイトル・テキストをボーダー・ラインの中央に配置します。static final int
タイトル・テキストにデフォルトの位置揃えを使用します。static final int
タイトル・テキストにデフォルトの垂直方向配置を使用します。protected static final int
ボーダーとコンポーネントのエッジの間のスペースstatic final int
左から右方向の場合はタイトル・テキストをボーダー・ラインの左側に、右から左方向の場合はボーダー・ラインの右側に配置します。static final int
タイトル・テキストをボーダー・ラインの左側に配置します。static final int
タイトル・テキストをボーダー・ラインの右側に配置します。protected static final int
左揃えまたは右揃えのテキストの水平インセットprotected static final int
ボーダーとテキストの間のスペースprotected String
枠線が表示されるタイトル。protected Color
タイトルの色。protected Font
タイトルをレンダリングするためのフォント。protected int
タイトルの理由。protected int
タイトルのポジション。static final int
タイトルをボーダーのトップ・ラインの中央に配置します。static final int
左から右方向の場合はタイトル・テキストをボーダー・ラインの右側に、右から左方向の場合はボーダー・ラインの左側に配置します。 -
コンストラクタのサマリー
コンストラクタ説明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のインスタンスを生成します。 -
メソッドのサマリー
修飾子と型メソッド説明int
getBaseline
(Component c, int width, int height) ベースラインを返します。サイズの変化に合わせてボーダーのベースラインがどのように変化するかを示す列挙を返します。タイトル付きボーダーのボーダーを返します。getBorderInsets
(Component c, Insets insets) insetsパラメータを、このBorderの現在のInsetsで初期化し直します。protected Font
タイトル付き枠線のデフォルト・フォントを返します。ボーダーとタイトルを完全に表示するためにボーダーに必要な最小サイズを返します。getTitle()
タイトル付きボーダーのタイトルを返します。タイトル付きボーダーのタイトル・カラーを返します。タイトル付きボーダーのタイトル・フォントを返します。int
タイトル付きボーダーのタイトル位置揃えを返します。int
タイトル付きボーダーのタイトル位置を返します。boolean
ボーダーが不透明かどうかを返します。void
paintBorder
(Component c, Graphics g, int x, int y, int width, int height) 指定されたコンポーネントのボーダーを、指定された位置およびサイズでペイントします。void
タイトル付きボーダーのボーダーを設定します。void
タイトル付きボーダーのタイトルを設定します。void
setTitleColor
(Color titleColor) タイトル付きボーダーのタイトル・カラーを設定します。void
setTitleFont
(Font titleFont) タイトル付きボーダーのタイトル・フォントを設定します。void
setTitleJustification
(int titleJustification) タイトル付きボーダーのタイトル位置揃えを設定します。void
setTitlePosition
(int titlePosition) タイトル付きボーダーのタイトル位置を設定します。クラスjavax.swing.border.AbstractBorderで宣言されたメソッド
getBorderInsets, getInteriorRectangle, getInteriorRectangle
-
フィールド詳細
-
title
protected String title枠線が表示されるタイトル。 -
border
protected Border borderボーダー。 -
titlePosition
protected int titlePositionタイトルのポジション。 -
titleJustification
protected int titleJustificationタイトルの理由。 -
titleFont
protected Font titleFontタイトルをレンダリングするためのフォント。 -
titleColor
protected Color titleColorタイトルの色。 -
DEFAULT_POSITION
public static final int DEFAULT_POSITIONタイトル・テキストにデフォルトの垂直方向配置を使用します。- 関連項目:
-
ABOVE_TOP
public static final int ABOVE_TOPタイトルをボーダーのトップ・ラインより上に配置します。- 関連項目:
-
TOP
public static final int TOPタイトルをボーダーのトップ・ラインの中央に配置します。- 関連項目:
-
BELOW_TOP
public static final int BELOW_TOPタイトルをボーダーのトップ・ラインより下に配置します。- 関連項目:
-
ABOVE_BOTTOM
public static final int ABOVE_BOTTOMタイトルをボーダーのボトム・ラインより上に配置します。- 関連項目:
-
BOTTOM
public static final int BOTTOMタイトルをボーダーのボトム・ラインの中央に配置します。- 関連項目:
-
BELOW_BOTTOM
public static final int BELOW_BOTTOMタイトルをボーダーのボトム・ラインより下に配置します。- 関連項目:
-
DEFAULT_JUSTIFICATION
public static final int DEFAULT_JUSTIFICATIONタイトル・テキストにデフォルトの位置揃えを使用します。- 関連項目:
-
LEFT
public static final int LEFTタイトル・テキストをボーダー・ラインの左側に配置します。- 関連項目:
-
CENTER
public static final int CENTERタイトル・テキストをボーダー・ラインの中央に配置します。- 関連項目:
-
RIGHT
public static final int RIGHTタイトル・テキストをボーダー・ラインの右側に配置します。- 関連項目:
-
LEADING
public static final int LEADING左から右方向の場合はタイトル・テキストをボーダー・ラインの左側に、右から左方向の場合はボーダー・ラインの右側に配置します。- 関連項目:
-
TRAILING
public static final int TRAILING左から右方向の場合はタイトル・テキストをボーダー・ラインの右側に、右から左方向の場合はボーダー・ラインの左側に配置します。- 関連項目:
-
EDGE_SPACING
protected static final int EDGE_SPACINGボーダーとコンポーネントのエッジの間のスペース- 関連項目:
-
TEXT_SPACING
protected static final int TEXT_SPACINGボーダーとテキストの間のスペース- 関連項目:
-
TEXT_INSET_H
protected static final int TEXT_INSET_H左揃えまたは右揃えのテキストの水平インセット- 関連項目:
-
-
コンストラクタの詳細
-
TitledBorder
-
TitledBorder
public TitledBorder(Border border) 指定されたボーダーと空のタイトルで、TitledBorderのインスタンスを生成します。- パラメータ:
border
- ボーダー
-
TitledBorder
-
TitledBorder
-
TitledBorder
public 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
- ペイントされるボーダーの高さ
-
getBorderInsets
insetsパラメータを、このBorderの現在のInsetsで初期化し直します。- オーバーライド:
getBorderInsets
、クラスAbstractBorder
- パラメータ:
c
- このボーダーのイン・セットの値を適用するコンポーネントinsets
- 初期化し直されるオブジェクト- 戻り値:
insets
オブジェクト- 例外:
NullPointerException
- 指定されたinsets
がnull
である場合
-
isBorderOpaque
public boolean isBorderOpaque()ボーダーが不透明かどうかを返します。- 定義:
isBorderOpaque
、インタフェースBorder
- オーバーライド:
isBorderOpaque
、クラスAbstractBorder
- 戻り値:
- false
-
getTitle
-
getBorder
-
getTitlePosition
public int getTitlePosition()タイトル付きボーダーのタイトル位置を返します。- 戻り値:
- タイトル付きボーダーのタイトル位置
-
getTitleJustification
public int getTitleJustification()タイトル付きボーダーのタイトル位置揃えを返します。- 戻り値:
- タイトル付きボーダーのタイトル位置揃え
-
getTitleFont
-
getTitleColor
-
setTitle
-
setBorder
-
setTitlePosition
public void setTitlePosition(int titlePosition) タイトル付きボーダーのタイトル位置を設定します。- パラメータ:
titlePosition
- ボーダーの位置
-
setTitleJustification
public void setTitleJustification(int titleJustification) タイトル付きボーダーのタイトル位置揃えを設定します。- パラメータ:
titleJustification
- ボーダーの位置揃え
-
setTitleFont
public void setTitleFont(Font titleFont) タイトル付きボーダーのタイトル・フォントを設定します。- パラメータ:
titleFont
- ボーダー・タイトルのフォント
-
setTitleColor
public void setTitleColor(Color titleColor) タイトル付きボーダーのタイトル・カラーを設定します。- パラメータ:
titleColor
- ボーダー・タイトルのカラー
-
getMinimumSize
-
getBaseline
public int getBaseline(Component c, int width, int height) ベースラインを返します。- オーバーライド:
getBaseline
、クラスAbstractBorder
- パラメータ:
c
- 要求されるComponent
ベースラインwidth
- ベースラインを取得する幅height
- ベースラインを取得する高さ- 戻り値:
- ベースラインまたは0より小さい値(適切なベースラインがないことを示す)
- 例外:
NullPointerException
-Component
がnull
の場合IllegalArgumentException
- 幅または高さが0より小さい場合- 導入されたバージョン:
- 1.6
- 関連項目:
-
getBaselineResizeBehavior
public Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c) サイズの変化に合わせてボーダーのベースラインがどのように変化するかを示す列挙を返します。- オーバーライド:
getBaselineResizeBehavior
、クラスAbstractBorder
- パラメータ:
c
- ベースラインのサイズ変更の動作を返すComponent
- 戻り値:
- ボーダーのサイズ変更に伴うベースラインの変化を示す列挙
- 例外:
NullPointerException
-Component
がnull
の場合- 導入されたバージョン:
- 1.6
- 関連項目:
-
getFont
-