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

What is actionlistener in java swing?

0 Answers  


What is swing api?

0 Answers  


When i m clicking on next another frame is open but i want to hide the previous frame...........but it is not happening....still both frame are visible........how to make one frame to hide.......please help me.......

9 Answers  


Write a program to include the internal frame in swing.

0 Answers  


What is import javax swing?

0 Answers  






can we create a object in static block class A { static { A a=new A(); } }

7 Answers   Cap Gemini,


What are swings awt?

0 Answers  


What is import javax swing * used for?

0 Answers  


how to give transparency for JComboBox,JListBox and JTable

2 Answers   TCS,


What is layout in java swing?

0 Answers  


Is swing still used?

0 Answers  


What is the purpose of serialization in swings?

0 Answers  


Categories