This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Constructing a TreePath?  RSS feed

 
Max Power
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello, i am using a tree to display a filesystem. the user has the option to rename a file or directory. after editing the valueForPathChanged method is invoked where the second parameter (Object value)contains the new pathname.
after changing the name of a directory i want a new treepath with the new diretoryname. example:

old path:

c:\programme --> treepath: [c:\, c:\programme]

was changed to

c:\programme1234 --> treepath: [c:\, c:\programme1234]

i have written a method that does exactly that:



after that im trying to create a new treepath with

TreePath tp = new TreePath(return value of replace)...

this gives me back a treepath that looks like a correct treepath, but the treepath does not work when im trying to use tree.expandPath(...)....why that?

THANKS:-)
 
Serghei Jelauc
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not shure, but try model.reload() method
 
Max Power
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, normally the expand method works without calling reload. i think the treepath is wong ?


bye
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!