🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10478

jTree setSelectionPath problem

#10478
From: Thomas Reck Guggenberger
Date: Tue, 05 Oct 1999 00:00
20 lines
1262 bytes
hi ,
i'm using the JTree and its necessary for me that 
i can set the focus of the treenode by a method of my
class.
JTree offers the method jTree.setSelectionPath(TreePath path);
With path.toString() i get a String like this:
"[root, first_child, second_child]" of the selected path.
How could i manage it to set the node as focused node if i have the
path wich i want to select by code just as a string like :
"[root, first_child";

I tried it with Object gh = "[root, firstchild]";
		TreePath tp = (TreePath) gh;
		jTree.setSelectionPath(tp);
but get a casting error-exception.

Thanks for any solutions.

Ciao Thomas
Technical Details
Message-ID: <37F9BDDC.4EEC37D3@transcom.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,7cdf69f8afa08dd5,start
X-Google-Attributes: gid111d45,public
From: Thomas Reck Guggenberger <reck@transcom.de>
Subject: jTree setSelectionPath problem
Date: 1999/10/05
Message-ID: <37F9BDDC.4EEC37D3@transcom.de>
X-Deja-AN: 532985659
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@de.uu.net
Organization: Customer of UUNET Deutschland GmbH, Dortmund, Germany
Mime-Version: 1.0
NNTP-Posting-Date: 5 Oct 1999 07:57:24 GMT
Newsgroups: borland.public.jbuilder.java.swing