• 追加された行はこの色です。
  • 削除された行はこの色です。
---
category: swing
folder: DrawsTreeFocus
title: JTreeのノードがフォーカス状態になった場合のBorderを変更する
tags: [JTree, UIManager, Border, Focus, LookAndFeel]
author: aterai
pubdate: 2014-06-16T01:26:31+09:00
description: JTreeのノードが選択されてフォーカス状態になった場合のBorderによる描画をUIManagerで変更します。
image: https://lh3.googleusercontent.com/-I62wWvQhdQI/U53BUsVLj9I/AAAAAAAACHk/SSHVLXv9m28/s800/DrawsTreeFocus.png
---
* 概要 [#summary]
`JTree`のノードが選択されてフォーカス状態になった場合の`Border`による描画を`UIManager`で変更します。

#download(https://lh3.googleusercontent.com/-I62wWvQhdQI/U53BUsVLj9I/AAAAAAAACHk/SSHVLXv9m28/s800/DrawsTreeFocus.png)

* サンプルコード [#sourcecode]
#code(link){{
UIManager.putBoolean("Tree.drawsFocusBorderAroundIcon", false);
UIManager.putBoolean("Tree.drawDashedFocusIndicator", false);
}}

* 解説 [#explanation]
- `Tree.drawsFocusBorderAroundIcon`
-- `true`の場合、`JTree`のノードアイコンを囲むように`Border`が拡張される(背景色で塗りつぶされる範囲は変化しない)
-- `MotifLookAndFeel`の初期値は`true`
-- `true`の場合`JTree`のノードアイコンを囲むように`Border`が拡張される
--- 背景色で塗りつぶされる範囲は変化しない
-- `MotifLookAndFeel`での初期値は`true`
- `Tree.drawDashedFocusIndicator`
-- `true`の場合、`JTree`のフォーカスの描画に使用する`Border`が点線になる
-- `WindowsLookAndFeel`の初期値は`true`
-- `true`の場合`JTree`のフォーカスの描画に使用する`Border`が点線になる
-- `WindowsLookAndFeel`での初期値は`true`

//* 参考リンク [#reference]
* 参考リンク [#reference]
- [https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html How to Use Trees (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)]

* コメント [#comment]
#comment
#comment