List of usage examples for java.awt KeyboardFocusManager getFocusedWindow
public Window getFocusedWindow()
From source file:Main.java
/** * Tries to find the current focused window. * /*w w w . j av a 2s. c om*/ * @return the current focused window, or <code>null</code> if no such window * could be found. */ public static final Window getCurrentWindow() { Window owner; final KeyboardFocusManager kbdFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); owner = kbdFocusManager.getFocusedWindow(); if (owner == null) { owner = kbdFocusManager.getActiveWindow(); } return owner; }