KeyboardFocusManager.getFocusedWindow() has the following syntax.
public Window getFocusedWindow()
In the following code shows how to use KeyboardFocusManager.getFocusedWindow() method.
/*from www . jav a 2 s . c om*/ import java.awt.KeyboardFocusManager; import java.awt.Window; public class Main { public static void main() { Window windowFocusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); } }
The code above generates the following result.