void (MouseEvent e) { JTree tree = (JTree)e.getSource(); int selRow = tree.getRowForLocation(e.getX(), e.getY()); if (selRow != -1) { TreePath treePath = tree.getPathForRow(selRow); if (treePath != null && treePath != tree.getEditingPath()) { final ErrorTreeElement element = getElement(treePath.getLastPathComponent()); if (element instanceof EditableMessageElement && ((EditableMessageElement)element).startEditingOnMouseMove()) { if (!tree.isRowSelected(selRow)) { tree.setSelectionRow(selRow); } tree.startEditingAtPath(treePath); } } } }