import javax.swing.*; import java.awt.BorderLayout; import java.awt.Container; public class JTreeLineExample{ public static void main(String args[]) { JFrame fm = new JFrame("JTree Line frame"); fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container ca = fm.getContentPane(); Box box = Box.createHorizontalBox(); JTree tree1 = new JTree(); JScrollPane scroll1 = new JScrollPane(tree1); JTree tree2 = new JTree(); JScrollPane scroll2 = new JScrollPane(tree2); box.add(scroll1, BorderLayout.WEST); box.add(scroll2, BorderLayout.EAST); fm.getContentPane().add(box, BorderLayout.CENTER); fm.setSize(300, 250); fm.setVisible(true); } }