Java tutorial
//package com.java2s; /* * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ import java.awt.EventQueue; import java.security.AccessController; import java.security.PrivilegedAction; import sun.awt.AWTAccessor; public class Main { private static void removeFwEventQueue() { AWTAccessor.getEventQueueAccessor().setFwDispatcher(getEventQueue(), null); } private static EventQueue getEventQueue() { return AccessController.doPrivileged( (PrivilegedAction<EventQueue>) () -> java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue()); } }