I have to build a JTree node with 2 JCheckBoxes amd 1 JTextField. I have implemented my TreeCellRenderer class which extends DefaultTreeCellRenderer and able to display the node by adding the three components (JCkeckBox and JTextField) in a JPanel. JTree is implementing Mouse Listener. CheckBoxes are fine,but, I am not able to edit the JTextField. To find out which Checkbox is clicked, I am using getX(). Is there a better way to do it?
posted 14 years ago
hi, for editing, you need to implement the TreeCellEditor, not (only) the TreeCellRenderer. I wonder why that works for JCheckBox? The default TreeCellEditor for JTree is a JTextField, anyway, I suppose. are your nodes mutable? cheers Chantal