Hey there, is there a way to convert a string to a tree path?
i can convert a path to a string, but not the other way around...

jTree1.getSelectionPath().toString()

thats the only way i know.. nooo idea how to convert it back??

I guess you'll have to write a small method that splits the String into its components, retrieves the actual Objects represented by those sub-strings, then start with an empty TreePath and use pathByAddingChild(Object child) to add all those objects to build the fill path. It's only the step of retrieving the actual Objects represented by the sub-strings that could be difficult, depending on your specific application.

I guess you'll have to write a small method that splits the String into its components, retrieves the actual Objects represented by those sub-strings, then start with an empty TreePath and use pathByAddingChild(Object child) to add all those objects to build the fill path. It's only the step of retrieving the actual Objects represented by the sub-strings that could be difficult, depending on your specific application.

thank you. after waisting two days, i just scratched everything and started over...
i hate it when that happens...
But thanx alot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.