Google Tag Manager

2013/03/30

JTree node edit only from JPopupMenu

Code

tree.setCellEditor(new DefaultTreeCellEditor(
    tree, (DefaultTreeCellRenderer)tree.getCellRenderer()) {
  @Override public boolean isCellEditable(java.util.EventObject e) {
    return (e instanceof MouseEvent)?false:super.isCellEditable(e);
  }
});
tree.setEditable(true);
tree.setComponentPopupMenu(new TreePopupMenu());

References

No comments:

Post a Comment