モジュール java.desktop
パッケージ 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 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​(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のインスタンスを生成します。
    • フィールドの詳細

      • 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

        @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

        public void paintBorder​(Component c,
                                Graphics g,
                                int x,
                                int y,
                                int width,
                                int height)
        指定されたコンポーネントのボーダーを、指定された位置およびサイズでペイントします。
        定義:
        paintBorder、インタフェース: Border
        オーバーライド:
        paintBorder、クラス: AbstractBorder
        パラメータ:
        c - このボーダーがペイントされるコンポーネント
        g - ペイント・グラフィックス
        x - ペイントされるボーダーのx座標
        y - ペイントされるボーダーのy座標
        width - ペイントされるボーダーの幅
        height - ペイントされるボーダーの高さ
      • getBorderInsets

        public Insets getBorderInsets​(Component c,
                                      Insets insets)
        insetsパラメータを、このBorderの現在のInsetsで初期化し直します。
        オーバーライド:
        getBorderInsets、クラス: AbstractBorder
        パラメータ:
        c - このボーダーのイン・セットの値を適用するコンポーネント
        insets - 初期化し直されるオブジェクト
        戻り値:
        insetsオブジェクト
      • isBorderOpaque

        public boolean isBorderOpaque​()
        ボーダーが不透明かどうかを返します。
        定義:
        isBorderOpaque、インタフェース: Border
        オーバーライド:
        isBorderOpaque、クラス: AbstractBorder
        戻り値:
        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)
        タイトル付きボーダーのタイトルを設定します。
        パラメータ:
        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 - このボーダーが描画されるコンポーネント
        戻り値:
        Dimensionオブジェクト
      • getBaseline

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

        protected Font getFont​(Component c)
        タイトル付きボーダーのデフォルト・フォントを返します。
        パラメータ:
        c - コンポーネント
        戻り値:
        タイトル付きボーダーのデフォルト・フォント