if (selPath == null) return null;
    private static Object getTreeSelectionOf(JTree tree, Class c) {	TreePath selPath = tree.getSelectionPath();		// Work backwards from end until we get to the kind of	// object we're looking for.	Object[] nodeList = selPath.getPath();	for (int i = nodeList.length - 1; i >= 0; --i) {	    DefaultMutableTreeNode node = (DefaultMutableTreeNode) nodeList[i];	    Object nodeInfo = node.getUserObject();	    if (nodeInfo != null && nodeInfo.getClass() == c)		return nodeInfo;	}	return null;    }