JavaTM Platform
Standard Ed. 6

javax.swing.border
クラス TitledBorder

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 でプロパティー値を定義します。

警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。JDK Version 1.4 以降、すべての JavaBeans の長期間の運用サポートは、java.beans パッケージに追加されています。詳細は、XMLEncoder を参照してください。


フィールドの概要
static int ABOVE_BOTTOM
          タイトルをボーダーのボトムラインより上に配置します。
static int ABOVE_TOP
          タイトルをボーダーのトップラインより上に配置します。
static int BELOW_BOTTOM
          タイトルをボーダーのボトムラインより下に配置します。
static int BELOW_TOP
          タイトルをボーダーのトップラインより下に配置します。
protected  Border border
           
static int BOTTOM
          タイトルをボーダーのボトムラインの中央に配置します。
static int CENTER
          タイトルテキストをボーダーラインの中央に配置します。
static int DEFAULT_JUSTIFICATION
          タイトルテキストにデフォルトの位置揃えを使用します。
static int DEFAULT_POSITION
          タイトルテキストにデフォルトの垂直方向配置を使用します。
protected static int EDGE_SPACING
           
static int LEADING
          左から右方向の場合はタイトルテキストをボーダーラインの左側に、右から左方向の場合はボーダーラインの右側に配置します。
static int LEFT
          タイトルテキストをボーダーラインの左側に配置します。
static int RIGHT
          タイトルテキストをボーダーラインの右側に配置します。
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
          タイトルをボーダーのトップラインの中央に配置します。
static int TRAILING
          左から右方向の場合はタイトルテキストをボーダーラインの右側に、右から左方向の場合はボーダーラインの左側に配置します。
 
コンストラクタの概要
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 のインスタンスを生成します。
TitledBorder(String title)
          TitledBorder インスタンスを作成します。
 
メソッドの概要
 int getBaseline(Component c, int width, int height)
          ベースラインを返します。
 Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c)
          サイズの変化に合わせてボーダーのベースラインがどのように変化するかを示す列挙を返します。
 Border getBorder()
          タイトル付きボーダーのボーダーを返します。
 Insets getBorderInsets(Component c)
          ボーダーのインセットの値を返します。
 Insets getBorderInsets(Component c, Insets insets)
          insets パラメータを、この Border の現在の Insets で初期化し直します。
protected  Font getFont(Component c)
           
 Dimension getMinimumSize(Component c)
          ボーダーとタイトルの全体を表示する場合にボーダーが必要とする、スペースの最小値を返します。
 String getTitle()
          タイトル付きボーダーのタイトルを返します。
 Color getTitleColor()
          タイトル付きボーダーのタイトルカラーを返します。
 Font getTitleFont()
          タイトル付きボーダーのタイトルフォントを返します。
 int getTitleJustification()
          タイトル付きボーダーのタイトル位置揃えを返します。
 int getTitlePosition()
          タイトル付きボーダーのタイトル位置を返します。
 boolean isBorderOpaque()
          ボーダーが不透明かどうかを返します。
 void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
          指定されたコンポーネントのボーダーを、指定された位置およびサイズでペイントします。
 void setBorder(Border border)
          タイトル付きボーダーのボーダーを設定します。
 void setTitle(String title)
          タイトル付きボーダーのタイトルを設定します。
 void setTitleColor(Color titleColor)
          タイトル付きボーダーのタイトルカラーを設定します。
 void setTitleFont(Font titleFont)
          タイトル付きボーダーのタイトルフォントを設定します。
 void setTitleJustification(int titleJustification)
          タイトル付きボーダーのタイトル位置揃えを設定します。
 void setTitlePosition(int titlePosition)
          タイトル付きボーダーのタイトル位置を設定します。
 
クラス javax.swing.border.AbstractBorder から継承されたメソッド
getInteriorRectangle, getInteriorRectangle
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

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

public TitledBorder(String title)
TitledBorder インスタンスを作成します。

パラメータ:
title - ボーダーに表示するタイトル

TitledBorder

public TitledBorder(Border border)
指定されたボーダーと空のタイトルで、TitledBorder のインスタンスを生成します。

パラメータ:
border - ボーダー

TitledBorder

public TitledBorder(Border border,
                    String title)
指定されたボーダーで TitledBorder のインスタンスを生成します。

パラメータ:
border - ボーダー
title - ボーダーに表示するタイトル

TitledBorder

public TitledBorder(Border border,
                    String title,
                    int titleJustification,
                    int titlePosition)
指定されたボーダー、タイトル、タイトルの位置揃え、およびタイトルの配置で、TitledBorder のインスタンスを生成します。

パラメータ:
border - ボーダー
title - ボーダーに表示するタイトル
titleJustification - タイトルの位置揃え
titlePosition - タイトルの位置

TitledBorder

public TitledBorder(Border border,
                    String title,
                    int titleJustification,
                    int titlePosition,
                    Font titleFont)
指定されたボーダー、タイトル、タイトルの位置揃え、タイトルの配置、およびタイトルのフォントで、TitledBorder のインスタンスを生成します。

パラメータ:
border - ボーダー
title - ボーダーに表示するタイトル
titleJustification - タイトルの位置揃え
titlePosition - タイトルの位置
titleFont - タイトルを描画するフォント

TitledBorder

public TitledBorder(Border border,
                    String title,
                    int titleJustification,
                    int titlePosition,
                    Font titleFont,
                    Color titleColor)
指定されたボーダー、タイトル、タイトルの位置揃え、タイトルの配置、タイトルのフォント、およびタイトルのカラーで、TitledBorder のインスタンスを生成します。

パラメータ:
border - ボーダー
title - ボーダーに表示するタイトル
titleJustification - タイトルの位置揃え
titlePosition - タイトルの位置
titleFont - タイトルのフォント
titleColor - タイトルのカラー
メソッドの詳細

paintBorder

public void paintBorder(Component c,
                        Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
指定されたコンポーネントのボーダーを、指定された位置およびサイズでペイントします。

定義:
インタフェース Border 内の paintBorder
オーバーライド:
クラス AbstractBorder 内の paintBorder
パラメータ:
c - このボーダーがペイントされるコンポーネント
g - ペイントのグラフィックス
x - ペイントされたボーダーの x 座標
y - ペイントされたボーダーの y 座標
width - ペイントされたボーダーの幅
height - ペイントされたボーダーの高さ

getBorderInsets

public Insets getBorderInsets(Component c)
ボーダーのインセットの値を返します。

定義:
インタフェース Border 内の getBorderInsets
オーバーライド:
クラス AbstractBorder 内の getBorderInsets
パラメータ:
c - このボーダーのインセットの値を適用するコンポーネント
戻り値:
0 に初期化される新しい Insets オブジェクト

getBorderInsets

public Insets getBorderInsets(Component c,
                              Insets insets)
insets パラメータを、この Border の現在の Insets で初期化し直します。

オーバーライド:
クラス AbstractBorder 内の getBorderInsets
パラメータ:
c - このボーダーのインセットの値を適用するコンポーネント
insets - 初期化し直されるオブジェクト
戻り値:
insets オブジェクト

isBorderOpaque

public boolean isBorderOpaque()
ボーダーが不透明かどうかを返します。

定義:
インタフェース Border 内の isBorderOpaque
オーバーライド:
クラス AbstractBorder 内の isBorderOpaque
戻り値:
false

getTitle

public String getTitle()
タイトル付きボーダーのタイトルを返します。


getBorder

public Border getBorder()
タイトル付きボーダーのボーダーを返します。


getTitlePosition

public int getTitlePosition()
タイトル付きボーダーのタイトル位置を返します。


getTitleJustification

public int getTitleJustification()
タイトル付きボーダーのタイトル位置揃えを返します。


getTitleFont

public Font getTitleFont()
タイトル付きボーダーのタイトルフォントを返します。


getTitleColor

public Color getTitleColor()
タイトル付きボーダーのタイトルカラーを返します。


setTitle

public void setTitle(String title)
タイトル付きボーダーのタイトルを設定します。


setBorder

public void setBorder(Border border)
タイトル付きボーダーのボーダーを設定します。

パラメータ:
border - ボーダー

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

public Dimension getMinimumSize(Component c)
ボーダーとタイトルの全体を表示する場合にボーダーが必要とする、スペースの最小値を返します。

パラメータ:
c - このボーダーが描画されるコンポーネント

getBaseline

public int getBaseline(Component c,
                       int width,
                       int height)
ベースラインを返します。

オーバーライド:
クラス AbstractBorder 内の getBaseline
パラメータ:
c - 要求される Component ベースライン
width - ベースラインを取得する幅
height - ベースラインを取得する高さ
戻り値:
ベースラインまたは 0 より小さい値 (適切なベースラインが 存在しない)
例外:
NullPointerException
IllegalArgumentException - 幅または高さが 0 より小さい場合
導入されたバージョン:
1.6
関連項目:
JComponent.getBaseline(int, int)

getBaselineResizeBehavior

public Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c)
サイズの変化に合わせてボーダーのベースラインがどのように変化するかを示す列挙を返します。

オーバーライド:
クラス AbstractBorder 内の getBaselineResizeBehavior
パラメータ:
c - ベースラインのサイズ変更の動作を返す Component
戻り値:
ボーダーのサイズ変更に伴うベースラインの変化を示す 列挙
例外:
NullPointerException
導入されたバージョン:
1.6
関連項目:
JComponent.getBaseline(int, int)

getFont

protected Font getFont(Component c)

JavaTM Platform
Standard Ed. 6

バグの報告と機能のリクエスト
さらに詳しい API リファレンスおよび開発者ドキュメントについては、Java SE 開発者用ドキュメントを参照してください。開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、およびコード実例が含まれています。

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。