Here's the deal. I need to select a leaf in a jtree using a click on a
button. I'm making some kind of MP3 player so when i press "next" i
need it to select the next leaf. When "shuffle" is pressed i need it to
select a random leaf. How do i do it?
> Here's the deal. I need to select a leaf in a jtree using a click on a
> button. I'm making some kind of MP3 player so when i press "next" i
> need it to select the next leaf. When "shuffle" is pressed i need it to
> select a random leaf. How do i do it?
setSelectionPath(), as you could easily have found out reading the API
documentation.
/Thomas
w3stkillah@gmail.com - 12 Apr 2006 13:26 GMT
I read the API. I had problems because the argument of
setSelectionPath() is TreePath. But i think i got it:
tree.setSelectionPath( new TreePath( node.getPath() ) );
Thanks!
Thomas Weidenfeller - 12 Apr 2006 14:10 GMT
> I read the API. I had problems because the argument of
> setSelectionPath() is TreePath.
So why didn't you ask about TreePath then?

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/