JavaTM 2 Platform
Std. Ed. v1.3

javax.swing.border
クラス CompoundBorder

java.lang.Object
  |
  +--javax.swing.border.AbstractBorder
        |
        +--javax.swing.border.CompoundBorder
すべての実装インタフェース:
Border, Serializable
直系の既知のサブクラス:
BorderUIResource.CompoundBorderUIResource

public class CompoundBorder
extends AbstractBorder

2 つの Border オブジェクトを合成して単一のボーダにするために使う、複合 Border クラスです。合成は、内側 Border オブジェクトを外側 Border オブジェクトのインセットの中に入れ子にして行います。 たとえば、すでに装飾ボーダがあるコンポーネントに空白のマージンを追加する場合などに、このクラスを使うことができます。

    Border border = comp.getBorder();
    Border margin = new EmptyBorder(10,10,10,10);
    comp.setBorder(new CompoundBorder(border, margin));
 

警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。今後の Swing リリースでは、長期間の持続性をサポートする予定です。

関連項目:
直列化された形式

フィールドの概要
protected  Border insideBorder
           
protected  Border outsideBorder
           
 
コンストラクタの概要
CompoundBorder()
          外側ボーダ、内側ボーダがともに null の複合ボーダを作成します。
CompoundBorder(Border outsideBorder, Border insideBorder)
          指定された内側ボーダおよび外側ボーダによる複合ボーダを作成します。
 
メソッドの概要
 Insets getBorderInsets(Component c)
          外側ボーダの insets の値を内側ボーダの insets に加算して、複合ボーダの insets の値を返します。
 Insets getBorderInsets(Component c, Insets insets)
          insets パラメータを、この Border の現在の Insets で初期化し直します。
 Border getInsideBorder()
          内側ボーダのオブジェクトを返します。
 Border getOutsideBorder()
          外側ボーダのオブジェクトを返します。
 boolean isBorderOpaque()
          複合ボーダが不透明かどうかを返します。
 void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
          複合ボーダをペイントします。
 
クラス javax.swing.border.AbstractBorder から継承したメソッド
getInteriorRectangle, getInteriorRectangle
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

outsideBorder

protected Border outsideBorder

insideBorder

protected Border insideBorder
コンストラクタの詳細

CompoundBorder

public CompoundBorder()
外側ボーダ、内側ボーダがともに null の複合ボーダを作成します。

CompoundBorder

public CompoundBorder(Border outsideBorder,
                      Border insideBorder)
指定された内側ボーダおよび外側ボーダによる複合ボーダを作成します。内側、外側のどちらも、null にしてもかまいません。
パラメータ:
outsideBorder - 外側ボーダ
insideBorder - 入れ子にする内側ボーダ
メソッドの詳細

isBorderOpaque

public boolean isBorderOpaque()
複合ボーダが不透明かどうかを返します。内側、外側のボーダがどちらも null でなく、不透明である場合に true を返し、そうでない場合は false を返します。
オーバーライド:
クラス AbstractBorder 内の isBorderOpaque

paintBorder

public void paintBorder(Component c,
                        Graphics g,
                        int x,
                        int y,
                        int width,
                        int height)
複合ボーダをペイントします。まず、外側ボーダを指定された位置とサイズでペイントし、次に内側ボーダを、外側ボーダのインセットから指定される位置とサイズのオフセットでペイントします。
オーバーライド:
クラス AbstractBorder 内の paintBorder
パラメータ:
c - このボーダがペイントされるコンポーネント
g - ペイントのグラフィックス
x - ペイントされたボーダの x 座標
y - ペイントされたボーダの y 座標
width - ペイントされたボーダの幅
height - ペイントされたボーダの高さ

getBorderInsets

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

getBorderInsets

public Insets getBorderInsets(Component c)
外側ボーダの insets の値を内側ボーダの insets に加算して、複合ボーダの insets の値を返します。
オーバーライド:
クラス AbstractBorder 内の getBorderInsets
パラメータ:
c - このボーダのインセットの値を適用するコンポーネント

getOutsideBorder

public Border getOutsideBorder()
外側ボーダのオブジェクトを返します。

getInsideBorder

public Border getInsideBorder()
内側ボーダのオブジェクトを返します。

JavaTM 2 Platform
Std. Ed. v1.3

バグや機能要求の報告
さらに詳しい API リファレンスおよび開発者ドキュメントについては、 Java 2 SDK SE Developer Documentation を参照してください。このドキュメントには、概念、用語の定義、回避策、 実用的なコード例など、開発者を対象にした詳細な解説が掲載されています。

Java、Java 2D、JDBC は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.