Swing/FixedSizeFileChooser のバックアップ差分(No.12)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/FixedSizeFileChooser へ行く。
- 1 (2007-01-22 (月) 13:27:16)
- 2 (2007-09-20 (木) 20:42:41)
- 3 (2013-02-10 (日) 00:03:06)
- 4 (2013-08-20 (火) 19:20:21)
- 5 (2013-09-13 (金) 00:16:40)
- 6 (2013-10-19 (土) 19:30:56)
- 7 (2014-11-25 (火) 03:03:31)
- 8 (2015-03-12 (木) 15:07:10)
- 9 (2017-01-26 (木) 17:54:56)
- 10 (2017-12-16 (土) 20:36:08)
- 11 (2018-01-19 (金) 13:35:50)
- 12 (2018-09-20 (木) 21:31:13)
- 13 (2020-09-19 (土) 21:44:33)
- 14 (2022-05-22 (日) 08:34:34)
- 追加された行はこの色です。
- 削除された行はこの色です。
--- category: swing folder: FixedSizeFileChooser title: JFileChooserのリサイズなどを制限 tags: [JFileChooser, JDialog] author: aterai pubdate: 2007-01-22T13:27:16+09:00 description: JFileChooserのリサイズや、最小サイズ以下へのサイズ変更を禁止します。 image: https://lh6.googleusercontent.com/_9Z4BYR88imo/TQTM16q-C_I/AAAAAAAAAZ0/i21vjp9vPjc/s800/FixedSizeFileChooser.png --- * 概要 [#summary] `JFileChooser`のリサイズや、最小サイズ以下へのサイズ変更を禁止します。 #download(https://lh6.googleusercontent.com/_9Z4BYR88imo/TQTM16q-C_I/AAAAAAAAAZ0/i21vjp9vPjc/s800/FixedSizeFileChooser.png) * サンプルコード [#sourcecode] #code(link){{ JFileChooser fileChooser = new JFileChooser() { @Override protected JDialog createDialog(Component parent) throws HeadlessException { JDialog dialog = super.createDialog(parent); dialog.setResizable(false); //dialog.setMinimumSize(new Dimension(640, 480)); // JDK 6 //dialog.addComponentListener(new MinimumSizeAdapter()); // dialog.setMinimumSize(new Dimension(640, 480)); // JDK 6 // dialog.addComponentListener(new MinimumSizeAdapter()); return dialog; } }; }} * 解説 [#explanation] 上記のサンプルでは、`JFileChooser`の`createDialog`メソッドをオーバーライドしてマウスでのリサイズ制限と、最小サイズの設定をテストすることができます。 上記のサンプルでは、`JFileChooser#createDialog()`メソッドをオーバーライドしてマウスでのリサイズ制限と、最小サイズの設定をテストすることができます。 `Windows`環境でも、`JDK 6`以上でオーバーライドした`createDialog`メソッド内で`JDialog#setMinimumSize(Dimension)`を使用すれば、最小サイズの設定が可能です。 * 参考リンク [#reference] - [https://community.oracle.com/thread/1374445 Swing - JFileChooser setMinimunSize not working?] - [[JFrameの最小サイズ>Swing/MinimumFrame]] * コメント [#comment] #comment #comment