Article View: borland.public.jbuilder.java.swing
Article #11531removing a node from a JTree
From: Stephan Grimm
Date: Wed, 19 May 1999 00:00
Date: Wed, 19 May 1999 00:00
34 lines
1437 bytes
1437 bytes
I have some problems in removing a TreeNode from a JTree.
I'm using DefaultMutableTreeNode as class for the Node-Objects and tried
the following remove-Operations:
DefaultMutableTreeNode TreeNode=
(DefaultMutableTreeNode)path.getLastPathComponent();
DefaultMutableTreeNode parentTreeNode=
(DefaultMutableTreeNode)path.getParentPath().getLastPathComponent();
// neither
parentTreeNode.remove(index); //with index represents treeNode
// nor
treeNode.removeFromParent();
// nor
parentTreeNode.remove(treeNode);
// did remove anything
All these remove-methods do not any modification to the JTree-Object, it
doesn't change its structure and the nodes to remove remain at their
places.
Those methods don't return a value so that I could get aware of a
fault-case.
Could anyone explain me what is the mistake ?
--
-Stephan Grimm-
<Stephan.Grimm@mgm-edv.de>
<grst0018@fh-karlsruhe.de>
GERMANY
Technical Details
Message-ID:
<37427B5A.B85EEA55@mgm-edv.de>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,f5bb01ac39cf223f,start X-Google-Attributes: gid111d45,public From: Stephan Grimm <Stephan.Grimm@mgm-edv.de> Subject: removing a node from a JTree Date: 1999/05/19 Message-ID: <37427B5A.B85EEA55@mgm-edv.de> X-Deja-AN: 479553648 Content-Transfer-Encoding: 7bit Organization: mgm X-Accept-Language: de,en Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing