private DefaultMutableTreeNode getSelectedNode() {
    TreePath path = myTree.getSelectionModel().getSelectionPath();
    return path == null ? null : (DefaultMutableTreeNode)path.getLastPathComponent();
  }
private DefaultMutableTreeNode getSelectedNode()