Swing/TextFieldMargin のバックアップの現在との差分(No.1)
2021-11-18 (木) 11:32:21
概要
JTextField
にMargin
、または二重のBorder
を設定して、内余白の変化をテストします。
Screenshot
Advertisement
サンプルコード
解説
以下のサンプルでは、それぞれ左側の内余白のサイズのみを変更しています。- 上:
UIManager.put()
ですべてのJTextField
の余白を指定-
getMargin().left
:7px
-
getInsets().left
:8px
-
getBorder().getBorderInsets(c).left
:8px
-
- 中: 「上(
UIManager.put()
)」とsetMargin()
で余白を指定-
getMargin().left
:17px
-
getInsets().left
:18px
-
getBorder().getBorderInsets(c).left
:18px
-
- 下: 「上(
UIManager.put()
)」とsetBorder()
で余白を指定-
getMargin().left
:7px
-
getInsets().left
:28px
-
getBorder().getBorderInsets(c).left
:28px
-