Swing Event Java Tutorial

Defined Methods Description
windowGainedFocus(WindowEvent e)Called when the window gains the focus such that the window or one of its components will receive keyboard events.
windowLostFocus(WindowEvent e)Called when the window loses the focus. After this event, neither the window nor any of its components will receive keyboard events.