File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTree - highlight the text when it is being changed

 
Alex Ku
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How do you highlight the text in a tree node when the user clicks the node or press F2 to change its value?
Thanks,
Kawaii
 
Alex Ku
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the file that sets up the JTree, I have

I override the getTreeCellEditorComponent in the DefaultTreeCellEditor class

this only works fine with F2 being pressed, not mouse clicked.
Anyone knows how to highlight the text for mouse clicked?
Thanks
[ January 22, 2002: Message edited by: kawaii desu ]

Nathan Pruett - Edited long CODE line.
[ January 23, 2002: Message edited by: Nathan Pruett ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic