Swing/BoldMetal のバックアップ差分(No.4)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/BoldMetal へ行く。
- 1 (2013-01-21 (月) 00:02:35)
- 2 (2013-01-28 (月) 02:19:01)
- 3 (2014-10-25 (土) 23:52:38)
- 4 (2014-12-31 (水) 01:39:58)
- 5 (2015-03-09 (月) 14:46:02)
- 6 (2015-03-16 (月) 17:28:33)
- 7 (2016-04-13 (水) 17:43:02)
- 8 (2016-06-01 (水) 18:59:23)
- 9 (2017-09-08 (金) 19:09:03)
- 10 (2018-09-26 (水) 13:54:12)
- 11 (2020-09-29 (火) 18:31:02)
- 12 (2022-05-31 (火) 17:35:48)
- 追加された行はこの色です。
- 削除された行はこの色です。
--- title: MetalLookAndFeelで太字フォントを使用しない tags: [MetalLookAndFeel, LookAndFeel, Font, UIManager, Html] author: aterai pubdate: 2013-01-21T00:02:35+09:00 description: MetalLookAndFeelで太字フォントを使用しないように設定します。 --- * 概要 [#kf9e9e61] `MetalLookAndFeel`で太字フォントを使用しないように設定します。 #download(https://lh4.googleusercontent.com/-7wQtHGyNRDQ/UPv6YyOBReI/AAAAAAAABbk/_vXFoJwk-ug/s800/BoldMetal.png) * サンプルコード [#vf3e0303] #code(link){{ UIManager.put("swing.boldMetal", Boolean.FALSE); }} * 解説 [#m53af62e] 上記のサンプルでは、`UIManager.put("swing.boldMetal", Boolean.FALSE);`として、`JLabel`、`JButton`、`TitleBorder`などのデフォルトとしてボールド(太字)フォントを使用しないように設定しています。 システムプロパティー`swing.boldMetal`を`false`に設定する方法でもボールド(太字)フォントを使用しないように設定することができます。 > java -Dswing.boldMetal=false example.MainPanel - デフォルトプロパティー`swing.boldMetal`が、システムプロパティー`swing.boldMetal`より優先される - `Html`で`<html><b>...</b></html>`のように装飾した場合は、デフォルトプロパティー`swing.boldMetal`より優先される(このサンプルでは、`JTabbedPane`の選択タブタイトルを`<html><b>...</b></html>`で装飾) - 以下のようにデフォルトプロパティー`swing.boldMetal`を更新することで切り替え可能 -- [http://docs.oracle.com/javase/jp/8/api/javax/swing/plaf/metal/DefaultMetalTheme.html DefaultMetalTheme (Java Platform SE 8)] #code{{ JCheckBox check = new JCheckBox("swing.boldMetal"); check.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JCheckBox c = (JCheckBox)e.getSource(); JCheckBox c = (JCheckBox) e.getSource(); UIManager.put("swing.boldMetal", c.isSelected()); // re-install the Metal Look and Feel try{ UIManager.setLookAndFeel(new MetalLookAndFeel()); }catch(Exception ex) { ex.printStackTrace(); } // Update the ComponentUIs for all Components. This // needs to be invoked for all windows. SwingUtilities.updateComponentTreeUI(SwingUtilities.getWindowAncestor(c)); } }); }} * 参考リンク [#b6aa141e] - [http://docs.oracle.com/javase/jp/8/api/javax/swing/plaf/metal/DefaultMetalTheme.html DefaultMetalTheme (Java Platform SE 8)] * コメント [#xdd77f22] #comment #comment