import java.awt.Component; import java.awt.KeyboardFocusManager; public class Main { public static void main() { Component compFocusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager() .getFocusOwner(); } }