TreePath tp = new TreePath(((DefaultMutableTreeNode) nonLeaf).getPath()); boolean selected = tree.isPathSelected(tp);
TreePath curr = new TreePath(((DefaultMutableTreeNode) nonLeaf).getPath()); boolean selected = tree.isPathSelected(curr); boolean expanded = tree.isExpanded(curr);
	private void paintNonLeaf(Graphics g, int x, int y, JTree tree,			Object nonLeaf)	{		TreePath tp = new TreePath(((DefaultMutableTreeNode) nonLeaf).getPath());		boolean selected = tree.isPathSelected(tp);		if (selected)		{			Component comp = tree.getCellRenderer()					.getTreeCellRendererComponent(tree, nonLeaf, true, false,							true, 0, false);			rendererPane.paintComponent(g, comp, tree, getCellBounds(x, y, nonLeaf));		}		else  {    Component c = tree.getCellRenderer().getTreeCellRendererComponent(tree, 					nonLeaf, false, false, false, 0, false);			    g.translate(x, y);    c.paint(g);    g.translate(-x, -y);  }	}