You would only find a method fireTreeModelChanged()
if your model extended a class containing such a method. But unlike TableModel
, which has an associated AbstractTableModel
containing fireXxx()
methods, there is no such class for trees. Your best bet is to either use a DefaultTreeModel
, or to define your own event firing methods.
Of course, to be able to implement them, you would need to actually add listeners in your addTreeModelListener()
method, instead of not doing anything.
Another thing that should be changed in your code is your comparisons of hash codes. It makes no sense doing that. BTW, two different classes could have the same hash code. Just use
parent.getClass().equals(MenuList.class)
or
parent instanceof MenuList