Hide JDialog window when the window lost focus
问题 Hi I have only one JDialog box in my Java application.I want to make it invisible if it lost the focus. I've tried different method, But didn't able to trigger any of the window focus events. Here is my code: public void windowGainedFocus(WindowEvent e) { System.out.println("gained focus"); } public void windowLostFocus(WindowEvent e) { System.out.println("lost focus"); } 回答1: Responding to Focus events can be really tricky. My experience has been that pretty much any time someone has