public DefaultMutableTreeNode getSelectedNode() {
    final Object selection = patternTree.getLastSelectedPathComponent();
    if (!(selection instanceof DefaultMutableTreeNode)) {
      return null;
    }
    return (DefaultMutableTreeNode)selection;
  }
public DefaultMutableTreeNode getSelectedNode()