RectangleInsetsクラス

広告

RectangleInsetsクラスのクラス図は次のようになっています。

  • java.lang.Object
  • org.jfree.ui.RectangleInsets
  • public class RectangleInsets extends java.lang.Object implements java.io.Serializable

用意されているコンストラクタは次の3つです。

コンストラクタ
RectangleInsets()
Creates a new instance with all insets initialised to 1.0.
RectangleInsets(double top, double left, double bottom, double right)
Creates a new instance with the specified insets (as 'absolute' units).
RectangleInsets(UnitType unitType, double top, double left, double bottom, double right)
Creates a new instance.

ではまず1番目のコンストラクタを見てみます。

Creates a new instance with all insets initialised to 1.0. 

1番目のコンストラクタでは上下左右の大きさは1.0dに設定されます。

次に2番目のコンストラクタを見てみます。

Creates a new instance with the specified insets (as 'absolute' units).

Parameters:
  top - the top insets.
  left - the left insets.
  bottom - the bottom insets.
  right - the right insets.

上左下右のそれぞれの大きさdouble型の値で指定します。

例えば次のように記述します。

RectangleInsets insets = new RectangleInsets(1d, 1d, 1d, 1d);

( Written by Tatsuo Ikura )