/** * Create a new window displaying the contents of the input Tree as * a Swing JTree. * @param t the Tree instance to display * @param labelField the data field to use for labeling nodes * @return a reference to the JFrame holding the tree view */ public static JFrame showTreeWindow(Tree t, String labelField) { JPrefuseTree tree = new JPrefuseTree(t, labelField); String title = t.toString(); if ( t instanceof VisualTree ) { title = ((VisualTree)t).getGroup() + " " + title; } JFrame frame = new JFrame(title); frame.getContentPane().add(new JScrollPane(tree)); frame.pack(); frame.setVisible(true); return frame; }