if ((event.getPropertyName()).equals("rootVisible"))
String property = event.getPropertyName(); if (property.equals(JTree.ROOT_VISIBLE_PROPERTY))
    public void propertyChange(PropertyChangeEvent event)    {      if ((event.getPropertyName()).equals("rootVisible"))        {          validCachedPreferredSize = false;          treeState.setRootVisible(tree.isRootVisible());          tree.repaint();        }    }