List of usage examples for javax.swing DefaultCellEditor stopCellEditing
public boolean stopCellEditing()
CellEditor
to the delegate
. From source file:Main.java
public static void main(final String args[]) { JFrame frame = new JFrame("Editable Tree"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTree tree = new JTree(); tree.setEditable(true);/*from w w w .j a v a 2 s . co m*/ DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer(); DefaultCellEditor comboEditor = new DefaultCellEditor(new JTextField()); comboEditor.stopCellEditing(); TreeCellEditor editor = new DefaultTreeCellEditor(tree, renderer, comboEditor); tree.setCellEditor(editor); JScrollPane scrollPane = new JScrollPane(tree); frame.add(scrollPane, BorderLayout.CENTER); frame.setSize(300, 150); frame.setVisible(true); }