Construct the object including its GUI
super("JTreeSimple");
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
myTree = new JTree();
JScrollPane scroller = new JScrollPane(myTree);
cp.add(BorderLayout.CENTER, scroller);
cp.add(BorderLayout.SOUTH, quitButton = new JButton("Exit"));
quitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
System.exit(0);
}
});
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();