Solved

How to create a TreePath from a string and expand the Tree

Posted on 2001-06-09
3
560 Views
Last Modified: 2012-08-13
Hi,
I have a string like "switch 0 , Blade 1"
where switch 0 is parent , blade1 is child and so on.

This string is generated dynamically but it represents
a valid treepath.

I want to expand the tree to show this particular
treepath.I am not able to create a valid TreePath
from this string.

I did something like this:

1) tokenize the string
2) make an object array of the tokens.
3) Treepath tp = new TreePath(object array);
4) Tree.expandpath(Treepath)

I get a "ClassCastException":java.lang.string

any suggestions?





0
Comment
Question by:sanjay_thakur
3 Comments
 
LVL 3

Accepted Solution

by:
superschlonz earned 100 total points
Comment Utility
I think you have to search the TreeNodes by name and then create
the treepath with these treenodes.
0
 
LVL 9

Expert Comment

by:Ovi
Comment Utility
post your code
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
superschlonz is correct.
You need to create your tree path from an array of tree nodes.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now