Please Help: Renaming a Node In JTree

Hi All-

I'm new to Swing, and am havingsome luck with this, but am running into a little issue that I'm not sure what is causing it... I am renaming a node in my JTree (which is working successfully), however, when the new name is being displayed, it is being displayed with a blue dot on the left side of it (probably indicating it's a node?) -- which Ido not want! How can I get rid of this? I would be really appreciative if some experience eyes could look at this and tell me where I'm going wrong...

Here is my code:

private void btnRenameIconActionPerformed(java.awt.event.ActionEvent evt) {

TreePath currentSelection = treeIcons.getSelectionPath();

if (currentSelection != null){

//Message box confirming renaming

int result = JOptionPane.showConfirmDialog(null, "Are you sure you want to rename the" +

" selected icon or category?", "Rename", JOptionPane.YES_NO_OPTION);

//If 'YES' -> Allow user to rename the selection

if(result == JOptionPane.YES_OPTION){

String newName = (String)JOptionPane.showInputDialog(null, "Input the new name:", "Rename", JOptionPane.PLAIN_MESSAGE);

DefaultMutableTreeNode lastNode = (DefaultMutableTreeNode)

(currentSelection.getLastPathComponent());

MutableTreeNode parent = (MutableTreeNode)(lastNode.getParent());

if (parent != null){

final String categoryName = lastNode.toString();

lastNode.setUserObject(newName);

}

DefaultTreeModel model = (DefaultTreeModel)treeIcons.getModel();

((DefaultTreeModel)treeIcons.getModel()).nodeChanged(lastNode);

return;

}

//If 'NO' -> -> Return to Icon Manager window

else{

return;

}

}

// If there was no selection

JOptionPane.showMessageDialog(this, "No icon or category was selected!");

}

Thanks in advance for your help, it is very much appreciated!!

-Jeanna

[1970 byte] By [JGeiera] at [2007-10-3 9:20:52]
# 1
First please use code tags.Second, I can't compile your program, so I can't see the blue dots you are talking about.
zadoka at 2007-7-15 4:34:15 > top of Java-index,Desktop,Core GUI APIs...
# 2

My apologies for the code tags; first time posting code, but should have previewed it before posting, my bad.

And, you're correct that you cannot compile, it's a small snipit of our project; I was just hoping that someone would see something in there that looked out-of-whack and know what was wrong.

However, I've been in that code some more this week and, after feeling rather silly, realized that 'the blue dot' actually denotes that after renaming, the parent node is getting changed to a child node (those have blue dots next to them under the parents....See, I even hate to admit that). So, my issue is that, when renaming a parent, it is getting changed to a child node.... Can anyone tell me by looking at my code where I'm messing that up?

Thanks much.

Swingily challenged yours,

-Jeanna

JGeiera at 2007-7-15 4:34:15 > top of Java-index,Desktop,Core GUI APIs...