|
Hi Carl, My code is almost identical to the DynamicTreeDemo.java
code: http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/index.html#DynamicTreeDemo If you take a look at the DynamicTreeDemo
code, you’ll notice that they don’t repaint after adding a node. I’m really baffled. If anyone has some time on their hands,
and Swing experience, I’ll send you my code to compare with
DynamicTreeDemo. Rgds, Enrico From: 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: 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]
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CTJUG Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/CTJUG-Forum -~----------~----~----~----~------~----~------~--~--- |
- [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
