Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with adding a node in jTree as it doesn't refresh

Status
Not open for further replies.

jack_daniels

Newbie level 1
Newbie level 1
Joined
Nov 2, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
Hi,
i´m trying to add a node in my jtree and make it show the added node but the tree doesn´t "refresh"
i´m posting the code here:

-----create tree-----
public JTree getJTreeContactos() {
if (jTreeContactos == null) {
DefaultMutableTreeNode grupo =
new DefaultMutableTreeNode("Amigos");
createNodes(grupo);//create the tree
jTreeContactos= new JTree(grupo);
jTreeContactos.setEditable(true);
jTreeContactos.getSelectionModel().setSelectionMod e
(TreeSelectionModel.SINGLE_TREE_SELECTION);
jTreeContactos.setBounds(new Rectangle(0, 0, 522, 268));
jTreeContactos.setShowsRootHandles(true);
}
return jTreeContactos;
}

-----add node-----
public void add_folha(String user_add)
{
nodd=new DefaultMutableTreeNode(user_add);
grupo.add(nodd);
jTreeContactos.scrollPathToVisible(new TreePath(nodd.getPath()));
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top