void (PropertyChangeEvent evt) { if (evt.getPropertyName().equals(JTree.TREE_MODEL_PROPERTY)){ ((TreeModel)evt.getOldValue()).removeTreeModelListener(this); ((TreeModel)evt.getNewValue()).addTreeModelListener(this); } }