Re: running a class from another class
Ok, I tried to simplify it : I'm experimenting by trying to make an
instance called "Pre_01" of the class CopyOfTreeView from the little
class 1.
Class 1 :
--------------------------------------------------------------------------------------------------------------------------------
package roddemo;
public class Lance {
public static void main(String[] argv) {
CopyOfTreeView Pre_01 = new CopyOfTreeView(null, null);
}
}
--------------------------------------------------------------------------------------------------------------------------------
Class 2 :
(was long, I trimed it, but kept all the classes/constructor, etc. as
well as the main method. BTW, am I supposed to keep the "main" in this
class or should I rename it?)
--------------------------------------------------------------------------------------------------------------------------------
package roddemo;
import java.awt.BorderLayout;
....
public class CopyOfTreeView extends Display {
private static final String tree = "tree";
...
public CopyOfTreeView(Tree t, String label) {
...
}
public void setOrientation(int orientation) {
...
}
...
}
public int getOrientation() {
...
}
public static void main(String argv[]) {
String infile = TREE_CHI;
String label = "name";
if ( argv.length > 1 ) {
infile = argv[0];
label = argv[1];
}
JComponent treeview = demo(infile, label);
JFrame frame = new JFrame("p r e | v i e w");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(treeview);
frame.pack();
frame.setVisible(true);
}
public static JComponent demo() {
...
}
public static JComponent demo(String datafile, final String label)
{
...
}
public class OrientAction extends AbstractAction {
...
}
public class AutoPanAction extends Action {
...
}
public static class NodeColorAction extends ColorAction {
...
} // end of inner class TreeMapColorAction
} // end of class TreeMap
--------------------------------------------------------------------------------------------------------------------------------
This produces a few errors (refering to the library I'll using) :
--------------------------------------------------------------------------------------------------------------------------------
Exception in thread "main" java.lang.IllegalArgumentException:
Unsupported TupleSet type.
at prefuse.Visualization.add(Visualization.java:245)
at prefuse.Visualization.add(Visualization.java:220)
at roddemo.CopyOfTreeView.<init>(CopyOfTreeView.java:91)
at roddemo.Lance.main(Lance.java:5)
--------------------------------------------------------------------------------------------------------------------------------