Pavel Tolkachev wrote:
> 
> Hello Mario,
> 
> Try to use this code snippet:
> 
> // -----cut here------
> import javax.swing.JTree;
> import javax.swing.tree.DefaultMutableTreeNode;
> import javax.swing.tree.DefaultTreeModel;
> ...
> DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
> DefaultMutableTreeNode c1 = new DefaultMutableTreeNode("Child1");
> DefaultMutableTreeNode c2 = new DefaultMutableTreeNode("Child2");
> DefaultMutableTreeNode gc1 = new DefaultMutableTreeNode("Grandchild1");
> DefaultMutableTreeNode gc2 = new DefaultMutableTreeNode("Grandchild2");
> DefaultMutableTreeNode ggc1 = new
> DefaultMutableTreeNode("GrandGrandChild1");
> DefaultMutableTreeNode c3 = new DefaultMutableTreeNode("Child3");
> 
> root.add(c1);
> root.add(c2);
> root.add(c3);
> c1.add(gc1);
> c1.add(gc2);
> gc1.add(ggc1);
> 
> DefaultTreeModel model = DefaultTreeModel(root);
> 
> JTree tree = new JTree(model);
> ...
> // -----cut here------
> 
> This is just the idea (to give you some starting point). To make
> applets, you have to provide the availability of Swing to the target
> browser somehow. Anyway to make something useful with JTree you will
> *have* to read the documentation and to do many experiments. Tutorial is
> the good starting point.

        Hi Pavel

        thanks for your help but now I have a different problem (actually
sumething i had already faced before). Watch this:

13:38:01$ javac teste.java
teste.java:42: Method
DefaultTreeModel(javax.swing.tree.DefaultMutableTreeNode) not found in
class teste.
DefaultTreeModel model = DefaultTreeModel(root);
                                         ^
1 error

I'm using the swingall.jar wich came with netbeans 2.1. Is there a
better one? Where ?

Thanks
-- 
        Mario Filipe 
        [EMAIL PROTECTED]
        http://neptuno.sc.uevora.pt/~mjnf


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to