After m.add( y );
you can use :
((DefaultTreeModel) tree.getModel()).nodesWereInserted(m,new int[]{m.getChildCount()-1});
Accordint to docs:
Invoke this method after you've inserted some TreeNodes into node. childIndices should be the index of the new elements and must be sorted in ascending order.
So that fires needed events and helps you.
Also use TreeSelectionListener
instead of MouseListener
as mentioned by @AndrewThompson.