Solved

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

Posted on 2001-06-09
3
567 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
superschlonz earned 100 total points
ID: 6171907
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
ID: 6186074
post your code
0
 
LVL 92

Expert Comment

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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 …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.

705 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