Swing/TextPositionAndAlignment のバックアップ(No.2)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- Swing/TextPositionAndAlignment へ行く。
- 1 (2009-03-16 (月) 13:43:23)
- 2 (2009-03-17 (火) 19:06:18)
- 3 (2013-01-10 (木) 17:56:55)
- 4 (2014-01-19 (日) 19:32:42)
- 5 (2014-10-29 (水) 01:36:17)
- 6 (2015-11-15 (日) 19:37:01)
- 7 (2017-05-11 (木) 12:21:12)
- 8 (2018-05-09 (水) 15:47:59)
- 9 (2020-04-29 (水) 19:50:15)
- 10 (2021-10-30 (土) 21:39:39)
- 11 (2025-01-03 (金) 08:57:02)
- 12 (2025-01-03 (金) 09:01:23)
- 13 (2025-01-03 (金) 09:02:38)
- 14 (2025-01-03 (金) 09:03:21)
- 15 (2025-01-03 (金) 09:04:02)
TITLE:JLabelのアイコンと文字列の位置
Posted by terai at 2009-03-16
JLabelのアイコンと文字列の位置
JLabelのアイコンと文字列の位置をテストします。
- &jnlp;
- &jar;
- &zip;
#screenshot
サンプルコード
label.setVerticalAlignment(SwingConstants.CENTER);
label.setVerticalTextPosition(SwingConstants.TOP);
label.setHorizontalAlignment(SwingConstants.RIGHT);
label.setHorizontalTextPosition(SwingConstants.LEFT);
解説
上記のサンプルでは、setVerticalAlignment、setVerticalTextPosition、setHorizontalAlignment、setHorizontalTextPositionといったメソッドを使用して、JLabelのアイコンと文字列の位置関係を変更しています。