Solved

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

Posted on 2001-06-09
3
566 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

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

732 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