|
Not a paint(Graphics g) problem?
Mebe you need to refresh the item on screen? Its been
years sisnce I did any java gui/awt/swign development :) But I recall that
sometimes you needed to manually tell the object to repaint itself or update or
something along those lines...
Rgds,
Carl From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Enrico Goosen Sent: 02 March 2006 16:34 To: [email protected] Subject: [CTJUG Forum] JTree problem Hi All, I’m experiencing a problem with a
JTree which is really baffling me. I’m trying to insert a node into a
JTree on a specific user action using this code (taken from The Java
Tutorial). public DefaultMutableTreeNode
addObject(DefaultMutableTreeNode parent,
Object child,
boolean shouldBeVisible) {
DefaultMutableTreeNode childNode =
new DefaultMutableTreeNode(child);
if (parent == null) {
parent = rootNode;
}
treeModel.insertNodeInto(childNode, parent,
parent.getChildCount());
//Make sure the user can see the lovely new node.
if (shouldBeVisible) {
tree.scrollPathToVisible(new
TreePath(childNode.getPath()));
}
return childNode;
} The problem is that the newly added
node doesn’t display in the JTree??! I’ve even added this to check that a
node was in fact added: return
(DefaultMutableTreeNode)fTreeModel.getChild(rootNode,
parent.getChildCount()-1); and it returns the node that was
added. But the JTree doesn’t display the
node. Any ideas what I’m doing
wrong? Enrico
Goosen Software
Developer SAICOM
TECHNOLOGY TEL:
+2721 555 0726 FAX:
+2721 555 0821 CEL:
+2783 305 5676 EMAIL:
[EMAIL PROTECTED]
|
- [CTJUG Forum] JTree problem Enrico Goosen
- [CTJUG Forum] Re: JTree problem Carl Olivier
- [CTJUG Forum] Re: JTree problem Enrico Goosen
- [CTJUG Forum] Re: JTree problem Ben van der Merwe
- [CTJUG Forum] Re: JTree problem Enrico Goosen
- [CTJUG Forum] Re: JTree problem Ben van der Merwe
