urlTree - / urlTree.java / / MVC architecture using JTree...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// urlTree.java // MVC architecture using JTree with a DefaultTreeModel / // Java core packages import java.awt.*; import java.awt.event.*; import java.util.*; i // Java extension packages import javax.swing.*; import javax.swing.tree.*; i import java.io.*; import java.net.*; i public class urlTree extends JFrame implements ActionListener { JTree tree; DefaultTreeModel treemodel; DefaultMutableTreeNode treenode; JButton button; String urlname; // urlTree constructor public urlTree(String url) { super( "COP 4610L: URL Tree" ); urlname = url; // model treenode = new DefaultMutableTreeNode(urlname); treemodel = new DefaultTreeModel(treenode); // create JTree tree = new JTree( treemodel ); // create control button = new JButton("get the links!"); button.addActionListener(this); Container container = getContentPane(); container.setLayout(new BorderLayout()); container.add( new JScrollPane(tree), BorderLayout.NORTH ); container.add( button, BorderLayout.SOUTH ); setDefaultCloseOperation( EXIT_ON_CLOSE );
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/14/2011 for the course COP 4610L taught by Professor Staff during the Spring '09 term at University of Central Florida.

Page1 / 3

urlTree - / urlTree.java / / MVC architecture using JTree...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online