FileDocCategorySizeDatePackage
JTreeSimple.javaAPI DocExample1147Sun Feb 22 21:39:22 GMT 2004None

JTreeSimple

public class JTreeSimple extends JFrame
Simple JFC JTree Simple application, showing default tree contents. Note that the JTree will display a silly demo with not Model provided.
version
$Id: JTreeSimple.java,v 1.2 2004/02/23 03:39:22 ian Exp $

Fields Summary
JButton
addButton
JButton
quitButton
JTree
myTree
Constructors Summary
public JTreeSimple()
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();
	
Methods Summary
public static voidmain(java.lang.String[] av)
"main program" method - construct and show

		// create a JTreeSimple object, tell it to show up
		new JTreeSimple().setVisible(true);