Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree Renderer - Editable issue

 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have created a custom tree cell renderer class which extends DefaultTreeCellRenderer. Basically I made getTreeCellRendererComponent method return a JLabel on which there are two JLabels and two JTextFields.

Now my issue is that I'am unable to edit the JTextField added on the renderer.

How do I go about it.

Thank you,
Sai.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try making yourself a class that implements TreeCellEditor and uses the same kind of Component, ie JLabel with labels and JTextFields on it, as your cell renderer. The idea is that when you select a node for editing the editor will appear and look just the same as the rendered node.
 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Craig,
Thank you for your response.
Ya, I will try that and see.

Thank you again,
Sai.
 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Craig.. It worked.
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!