Java tutorial
import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTree; public class MainClass { public static void main(String args[]) { JFrame f = new JFrame("JTree Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTree tree = new JTree(); JScrollPane scrollPane = new JScrollPane(tree); f.add(scrollPane, BorderLayout.CENTER); f.setSize(300, 200); f.setVisible(true); } }