[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

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

Posted on 2001-06-09
3
Medium Priority
?
572 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 300 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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 “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

650 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