Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Display Files without extension in a JTree  RSS feed

 
Manjula Rao
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
could any one help me with inflating a JTree component with all the files of a particular directory. i have been able to show the fle names in the JTree but i need to show only the file name NOT the extension.
thanx
Manjula
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Research the tutorial How to Use Trees I also think you may get more help in AWT/JFC/Swing forum so, I'm moving this there
 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that JTree uses the toString() method of its nodes' userObject to display. So if you wanted to display different text, subclass File (your user object in this case) and override its toString() method to only return the characters after the last file delimiter.
Let me know how that works!
e
[This message has been edited by eric moon (edited January 17, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!