JTreeのノード間の接続線のスタイルを変更する
Total: 3450
, Today: 2
, Yesterday: 2
Posted by aterai at
Last-modified:
Summary
JTree
のノード間の接続線のスタイルを変更、または非表示にします。
Screenshot

Advertisement
Source Code Examples
JTree tree0 = new JTree();
tree0.putClientProperty("JTree.lineStyle", "Angled");
JTree tree1 = new JTree();
tree1.putClientProperty("JTree.lineStyle", "Horizontal");
JTree tree2 = new JTree();
tree2.putClientProperty("JTree.lineStyle", "None");
View in GitHub: Java, KotlinExplanation
上記のサンプルでは、JTree
にJTree#putClientProperty("JTree.lineStyle", "Angled")
などを設定して
各ノード間の接続線スタイルを変更してます。これらの設定はMetalLookAndFeel
を使用している場合のみ有効です。
Angled
(Default
)- ノード間を接続する水平垂直線を表示する(デフォルト)
Horizontal
- グループ(親)ノードの上下に水平線のみ表示する
None
- ノード間の接続線をすべて非表示にする
Reference
- How to Use Trees (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
- JTreeの水平垂直線を表示しない