Swing/NumberEditor のバックアップソース(No.5)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- バックアップ を表示
- Swing/NumberEditor へ行く。
- 1 (2005-10-31 (月) 11:17:46)
- 2 (2006-01-26 (木) 14:18:23)
- 3 (2006-02-27 (月) 16:17:40)
- 4 (2006-12-28 (木) 12:16:38)
- 5 (2007-09-20 (木) 20:41:11)
- 6 (2013-03-22 (金) 11:45:37)
- 7 (2015-09-30 (水) 19:05:47)
- 8 (2017-04-11 (火) 13:17:25)
- 9 (2018-04-05 (木) 10:30:15)
- 10 (2020-04-03 (金) 17:32:08)
- 11 (2021-10-07 (木) 10:53:37)
TITLE:JSpinnerの値をパーセントで指定 #navi(../) *JSpinnerの値をパーセントで指定 [#t29c7b07] >編集者:[[Terai Atsuhiro>terai]]~ 作成日:2005-10-31~ 更新日:&lastmod; #contents **概要 [#v1407fe1] JSpinnerの値をパーセントで指定するように設定します。 #screenshot **サンプルコード [#k32fce56] #code{{ JSpinner spinner = new JSpinner(new SpinnerNumberModel(0, 0, 1, 0.01)); JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner, "0%"); editor.getTextField().setEditable(false); spinner.setEditor(editor); }} -&jnlp; -&jar; -&zip; **解説 [#af34e284] JSpinner.NumberEditorのコンストラクタに、DecimalFormatオブジェクトのパターンを入力すると数値の解析とフォーマットを行ってくれます。 上記のサンプルでは、数字を表す"0"と、100倍してパーセントを表す"%"を組み合わせたフォーマットパターンを使用しています。 //**参考リンク **コメント [#f777681c] #comment