Swing/FixedSizeFileChooser のバックアップの現在との差分(No.4)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - 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)
- 追加された行はこの色です。
- 削除された行はこの色です。
TITLE:JFileChooserのリサイズなどを制限 #navi(../) #tags(JFileChooser, JDialog) RIGHT:Posted by &author(aterai); at 2007-01-22 *JFileChooserのリサイズなどを制限 [#b6bb287d] ``JFileChooser``のリサイズや、最小サイズ以下へのサイズ変更を禁止します。 --- 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`のリサイズや、最小サイズ以下へのサイズ変更を禁止します。 //-&jnlp; -&jar; -&zip; #download(https://lh6.googleusercontent.com/_9Z4BYR88imo/TQTM16q-C_I/AAAAAAAAAZ0/i21vjp9vPjc/s800/FixedSizeFileChooser.png) //#screenshot #ref(http://lh6.ggpht.com/_9Z4BYR88imo/TQTM16q-C_I/AAAAAAAAAZ0/i21vjp9vPjc/s800/FixedSizeFileChooser.png) **サンプルコード [#i99787b1] * サンプルコード [#sourcecode] #code(link){{ JFileChooser fileChooser = new JFileChooser() { protected JDialog createDialog(Component parent) throws HeadlessException { @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; } }; }} **解説 [#i7707be5] ``JFileChooser``の``createDialog``メソッドをオーバーライドして、リサイズを制限したり、最小サイズを設定したりしています。 * 解説 [#explanation] - `JFileChooser#createDialog()`メソッドをオーバーライドしてマウスでのリサイズ制限と、最小サイズを設定 - `Windows`環境でも`JDK 6`以上でオーバーライドした`createDialog`メソッド内で`JDialog#setMinimumSize(Dimension)`を使用すれば最小サイズの設定が可能 ``JDK 6``では、``Windows``環境でも、オーバーライドした``createDialog``メソッド内で、``JDialog#setMinimumSize(Dimension)``を使うだけで、最小サイズの設定が出来るようになっています。 * 参考リンク [#reference] - [https://community.oracle.com/thread/1374445 Swing - JFileChooser setMinimunSize not working?] - [[JFrameの最小サイズ>Swing/MinimumFrame]] **参考リンク [#z0f87abe] -[http://forums.sun.com/thread.jspa?threadID=5123511 Swing - JFileChooser setMinimunSize not working?] -[[JFrameの最小サイズ>Swing/MinimumFrame]] **コメント [#x9017146] * コメント [#comment] #comment #comment