I am working with a JTree with DefaultTreeModel. I am customizing my menuBar using tree. That means my tree nodes are menuitems. Problem is I dont know how to add focuslistener so that when I select another node of tree I want to validate previous selected node. So my approach is that when focus lost from selected node validate it. Is my approach correct, if yes then how to add focuslistener?