モジュール java.desktop
パッケージ javax.swing.border

クラスAbstractBorder

java.lang.Object
javax.swing.border.AbstractBorder
すべての実装されたインタフェース:
Serializable, Border
直系の既知のサブクラス:
BasicBorders.ButtonBorder, BasicBorders.FieldBorder, BasicBorders.MarginBorder, BasicBorders.MenuBarBorder, BevelBorder, CompoundBorder, EmptyBorder, EtchedBorder, LineBorder, MetalBorders.ButtonBorder, MetalBorders.Flush3DBorder, MetalBorders.InternalFrameBorder, MetalBorders.MenuBarBorder, MetalBorders.MenuItemBorder, MetalBorders.OptionDialogBorder, MetalBorders.PaletteBorder, MetalBorders.PopupMenuBorder, MetalBorders.ScrollPaneBorder, MetalBorders.TableHeaderBorder, MetalBorders.ToolBarBorder, StrokeBorder, TitledBorder

public abstract class AbstractBorder
extends Object
implements Border, Serializable
サイズ指定のない空のボーダーを実装するクラスです。 ほかのボーダーのクラスを簡単に派生できる、便利な基底クラスを提供します。

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

  • コンストラクタの詳細

    • AbstractBorder

      public AbstractBorder()
  • メソッドの詳細

    • paintBorder

      public void paintBorder​(Component c, Graphics g, int x, int y, int width, int height)
      このデフォルト実装では、ペイントを行いません。
      定義:
      paintBorder、インタフェース: Border
      パラメータ:
      c - このボーダーがペイントされるコンポーネント
      g - ペイント・グラフィックス
      x - ペイントされるボーダーのx座標
      y - ペイントされるボーダーのy座標
      width - ペイントされるボーダーの幅
      height - ペイントされるボーダーの高さ
    • getBorderInsets

      public Insets getBorderInsets​(Component c)
      このデフォルトの実装は、getBorderInsets(Component,Insets)メソッドによって初期化される新しいInsetsオブジェクトを返します。 デフォルトでは、topleftbottom、およびrightフィールドは0に設定されます。
      定義:
      getBorderInsets、インタフェース: Border
      パラメータ:
      c - このボーダーのイン・セットの値を適用するコンポーネント
      戻り値:
      新しいInsetsオブジェクト
    • getBorderInsets

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

      public boolean isBorderOpaque()
      このデフォルト実装はfalseを返します。
      定義:
      isBorderOpaque、インタフェース: Border
      戻り値:
      false
    • getInteriorRectangle

      public Rectangle getInteriorRectangle​(Component c, int x, int y, int width, int height)
      静的メソッドを呼び出す簡易メソッドです。
      パラメータ:
      c - このボーダーが計算されるコンポーネント
      x - ボーダーのx座標
      y - ボーダーのy座標
      width - ボーダーの幅
      height - ボーダーの高さ
      戻り値:
      内部座標を持つRectangle
    • getInteriorRectangle

      public static Rectangle getInteriorRectangle​(Component c, Border b, int x, int y, int width, int height)
      ボーダーのイン・セットから引数の値を減算して矩形を返します。 コンポーネントが描画して埋める領域を、ボーダーと交差しないように決めるのに便利です。
      パラメータ:
      c - このボーダーが計算されるコンポーネント
      b - Borderオブジェクト
      x - ボーダーのx座標
      y - ボーダーのy座標
      width - ボーダーの幅
      height - ボーダーの高さ
      戻り値:
      内部座標を持つRectangle
    • getBaseline

      public int getBaseline​(Component c, int width, int height)
      ベースラインを返します。 戻り値が0より小さい場合は、ボーダーのベースラインが適切ではありません。

      デフォルト実装は -1を返します。 ベースラインをサポートするサブクラスで適切にオーバーライドする必要があります。 戻り値が0以上の場合、コンポーネントのベースラインは最小サイズ以上の任意のサイズに対して有効であり、getBaselineResizeBehaviorを使ってサイズによるベースラインの変化を特定できます。

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

      public Component.BaselineResizeBehavior getBaselineResizeBehavior​(Component c)
      サイズの変化に合わせてコンポーネントのベースラインがどのように変化するかを示す列挙を返します。 このメソッドは、主にレイアウト・マネージャとGUIビルダーで使用されます。

      デフォルトの実装はBaselineResizeBehavior.OTHERを返し、ベースラインをサポートするサブクラスは適切にオーバーライドする必要があります。 サブクラスはnullを返さないようにしてください。ベースラインを計算できない場合は、BaselineResizeBehavior.OTHERを返します。 呼出し元はまず、getBaselineを使用して、ベースラインを要求するようにしてください。0以上の値が返された場合に、このメソッドを使用します。 getBaselineで0未満の値が返された場合でも、このメソッドでBaselineResizeBehavior.OTHER以外の値を返すことは可能です。

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