How to add and delete nodes in Jtree?



How to add and delete nodes in Jtree?..

Answer / ramachandran

Iam try this code but not properly working...yor try to get
ans and post..........




DefaultTreeModel model = (DefaultTreeModel)tree.getModel();
DefaultMutableTreeNode root =
(DefaultMutableTreeNode)model.getRoot();
root.add(new DefaultMutableTreeNode("another_child"));
model.reload(root);..........

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Swing Interview Questions

I want to change the appearance of Frame in Runtime, what class can be used to do this?

2 Answers   TCS, Wipro,


What are the swing components?

0 Answers  


Explain the differences between an applet and a Japplet?

2 Answers   College School Exams Tests, Satyam,


Default layout for a ContentPane in JFC?

8 Answers   HCL,


What is JTable and what is its purpose?

4 Answers  






What are the advantages of the event-delegation model over the event-inheritance model?

0 Answers  


What is sling swing?

0 Answers  


What are the differences between Swing and AWT?

0 Answers  


What is jfc swing in java?

0 Answers  


What is the use of jcomponent class in swing?

0 Answers  


What are the advantages of swing over awt?

0 Answers  


What is the use of JTree?

3 Answers  


Categories