import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
public class TreeLines {
public static void main(String args[]) {
JFrame frame = new JFrame("Tree Lines");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = frame.getContentPane();
Box box = Box.createHorizontalBox();
JTree tree1 = new JTree();
tree1.putClientProperty("JTree.lineStyle", "Angled");
JScrollPane scrollPane1 = new JScrollPane(tree1);
tree1.setAutoscrolls(true);
JTree tree2 = new JTree();
JScrollPane scrollPane2 = new JScrollPane(tree2);
box.add(scrollPane1, BorderLayout.WEST);
box.add(scrollPane2, BorderLayout.EAST);
frame.getContentPane().add(box, BorderLayout.CENTER);
frame.setSize(300, 240);
frame.setVisible(true);
}
}
|