Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

TextField in JTree not editable  RSS feed

 
Arvind Sampath
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added a few JTextFields to a JTree. The problem is those text boxes are not editable. Find below the code for my CellRenderer



I tried many options setting the editable/enabled fields of the text box. But still the text box remains uneditable.

Any help is greatly appreciated.
 
Brian Cole
Author
Ranch Hand
Posts: 949
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Arvind Sampath:
I have added a few JTextFields to a JTree. The problem is those text boxes are not editable. Find below the code for my CellRenderer


You need a TreeCellEditor. TreeCellRenderer does display only.
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also make sure the tree is editable, using the setEditable method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!