import java.awt.Container;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
class Demo extends JFrame{
JTree jt;
Demo(){
DefaultMutableTreeNode a=new DefaultMutableTreeNode("A");
DefaultMutableTreeNode b=new DefaultMutableTreeNode("B");
DefaultMutableTreeNode c=new DefaultMutableTreeNode("C");
DefaultMutableTreeNode d=new DefaultMutableTreeNode("D");
Container c1=getContentPane();
c1.setLayout(new FlowLayout());
setSize(500,500);
a.add(c);
a.add(b);
b.add(d);
jt =new JTree(a);
c1.add(jt);
}
}
public class Tree {
public static void main(String arg[]){
Demo d=new Demo();
d.setVisible(true);
}
}
A blog provide anexample with sample code for swing , servlet, jdbc and odbc connection to database, jsp, servlets, taglib, sql server, cassandra and many more. we also provide Apache camel sample code for integration.
Wednesday, November 7, 2012
Jtree
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment