jtree problem
//get length of each online and offline nodes.
int online_count = treeModel.getChildCount(online) - 1;
int offline_count = treeModel.getChildCount(offline) - 1;
Object temp;
for(int i =0; i <= online_count; i++)
{
//get the username
temp = treeModel.getChild(online, i);
JOptionPane temp_node = new DefaultMutableTreeNode(temp);
//convert it to string
String info = temp_node.toString();
String status = query(info);
// if their offline, remove from online node and insert
//into the offline node.
JOptionPane.showMessageDialog(null, " status of " + info + " is" + status, null, JOptionPane.ERROR_MESSAGE);
if(status.equals("Offline") == true)
{
treeModel.removeNodeFromParent(temp_node);
treeModel.insertNodeInto(temp_node, offline, offline.getChildCount());
//repaint the jtree
userTree.setModel(treeModel);
userTree.scrollPathToVisible(new TreePath(offline.getPath()));
JOptionPane.showMessageDialog(null, "node moved succesfuly in offline,", null, JOptionPane.ERROR_MESSAGE);
}
}
Where it gets the username i.e. temp = treeModel.getChild(online, i); how can I get both the parent and object of that specific node so that I can remove the node from its treemodel. Any comments?

