Removing the Focus from the Application
import java.awt.KeyboardFocusManager; public class Main { public static void main(String[] argv) throws Exception { KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); } }