Swing/ComponentSizeVariant のバックアップソース(No.1)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- バックアップ を表示
- Swing/ComponentSizeVariant へ行く。
- 1 (2014-07-28 (月) 00:18:57)
- 2 (2014-11-07 (金) 03:29:38)
- 3 (2015-12-02 (水) 00:50:08)
- 4 (2017-03-28 (火) 15:09:38)
- 5 (2017-04-04 (火) 14:17:08)
- 6 (2018-02-08 (木) 16:18:37)
- 7 (2018-11-09 (金) 17:21:52)
- 8 (2020-11-05 (木) 11:36:44)
- 9 (2022-10-21 (金) 11:59:04)
- 10 (2025-01-03 (金) 08:57:02)
- 11 (2025-01-03 (金) 09:01:23)
- 12 (2025-01-03 (金) 09:02:38)
- 13 (2025-01-03 (金) 09:03:21)
- 14 (2025-01-03 (金) 09:04:02)
- 15 (2025-06-19 (木) 12:41:37)
- 16 (2025-06-19 (木) 12:43:47)
TITLE:NimbusLookAndFeelでJComponentのサイズを変更する #navi(../) #tags(NimbusLookAndFeel, JComponent, Font) RIGHT:Posted by &author(aterai); at 2014-07-28 * NimbusLookAndFeelでJComponentのサイズを変更する [#ofcff4ab] `NimbusLookAndFeel`を使用している場合、クライアントプロパティを設定することで`JComponent`の表示サイズを変更することが出来ます。 #download #ref(https://lh6.googleusercontent.com/-Uru9Oco4olg/U9T5RHzJ_5I/AAAAAAAACKY/7N7a3Ya3sYw/s800/ComponentSizeVariant.png) ** サンプルコード [#j46526e5] #code(link){{ booleanRenderer.putClientProperty("JComponent.sizeVariant", "mini"); }} ** 解説 [#o36d06e7] - `NimbusLookAndFeel`を使用している場合、`JComponent#putClientProperty("JComponent.sizeVariant", "mini");`のように、クライアントプロパティを設定することで、その表示サイズを変更可能 -- デフォルトは`regular`、その他は小さい順に`mini`, `small`, `large`が設定可能 -- `JComponent#updateUI()`を実行しないと、更新されない --- このサンプルでは、`SwingUtilities.updateComponentTreeUI(window);`で実行 -- フォントがユーザー指定されている場合は、文字サイズは更新されない? --- このサンプルでは、`updateUI()`の前に、`jc.setFont(new FontUIResource(jc.getFont()));`で`UIResource`化することで回避 -- `JTable`の`BooleanRenderer`が二回目以降変更されない --- 初回の`((JCheckBox) table.getDefaultRenderer(Boolean.class)).putClientProperty("JComponent.sizeVariant", "mini");`は、正常に動作しているように見える ** 参考リンク [#bd728307] - [http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/size.html Resizing a Component (The Java™ Tutorials > Creating a GUI With JFC/Swing > Modifying the Look and Feel)] ** コメント [#a447fafd] #comment