treeModel = tree.getModel(); treeModel.addTreeModelListener(treeModelListener);
setModel(tree.getModel()); } else if (property.equals(JTree.CELL_RENDERER_PROPERTY)) { setCellRenderer(tree.getCellRenderer());  if (treeState != null) treeState.invalidateSizes();
    public void propertyChange(PropertyChangeEvent event)    {      String property = event.getPropertyName();      if (property.equals(JTree.ROOT_VISIBLE_PROPERTY))        {          validCachedPreferredSize = false;          treeState.setRootVisible(tree.isRootVisible());          tree.repaint();        }      else if (property.equals(JTree.SELECTION_MODEL_PROPERTY))        {          treeSelectionModel = tree.getSelectionModel();          treeSelectionModel.setRowMapper(treeState);        }      else if (property.equals(JTree.TREE_MODEL_PROPERTY))        {          treeModel = tree.getModel();          treeModel.addTreeModelListener(treeModelListener);        }    }