KeyboardFocusManager: getFocusedWindow()
import java.awt.KeyboardFocusManager; import java.awt.Window; public class Main { public static void main() { Window windowFocusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); } }