I encoded an animation that removes the search bar from my navigation bar when a user clicks on the Users tab.
I want the reverse animation to play if my search bar loses focus or if the navigation button that the user clicked to move the bar loses focus (as described in Figure 1) 
I am currently achieving an effect by setting the onMouseExited property of search_wrapper to run my hideUsers() method, but ideally I want to check
nav_button.setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { if(search_wrapper loses focus OR nav_button loses focus) hideUsers(); } }
How can i do this? I am tired of using the .isFocused () method for both elements, but gave nothing.
Any feedback is welcome.
source share