Java Code Examples for java.awt.Toolkit#getSystemEventQueue()

The following examples show how to use java.awt.Toolkit#getSystemEventQueue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EventLock.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Similar to {@link EventQueue#invokeAndWait} but posts the event at the same
 * priority as paint requests, to avoid bad visual artifacts.
 */
static void invokeAndWaitLowPriority(RWLock m, Runnable r)
        throws InterruptedException, InvocationTargetException {
    Toolkit t = Toolkit.getDefaultToolkit();
    EventQueue q = t.getSystemEventQueue();
    Object lock = new PaintPriorityEventLock();
    InvocationEvent ev = new PaintPriorityEvent(m, t, r, lock, true);
    synchronized (lock) {
        q.postEvent(ev);
        lock.wait();
    }
    Exception e = ev.getException();
    if (e != null) {
        throw new InvocationTargetException(e);
    }
}
 
Example 2
Source File: Permissions.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 3
Source File: Permissions.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 4
Source File: Permissions.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 5
Source File: Permissions.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 6
Source File: Permissions.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 7
Source File: Permissions.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 8
Source File: Permissions.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 9
Source File: Permissions.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 10
Source File: Permissions.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 11
Source File: Permissions.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 12
Source File: Permissions.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 13
Source File: Permissions.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 14
Source File: Permissions.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    MySecurityManager sm = MySecurityManager.install();

    Toolkit toolkit = Toolkit.getDefaultToolkit();

    sm.prepare("Toolkit.getSystemClipboard()");
    toolkit.getSystemClipboard();
    sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Toolkit.getSystemEventQueue()");
    toolkit.getSystemEventQueue();
    sm.assertChecked(AWTPermission.class, "accessEventQueue");

    sm.prepare("Toolkit.getSystemSelection()");
    toolkit.getSystemSelection();
    //sm.assertChecked(AWTPermission.class, "accessClipboard");

    sm.prepare("Window(Frame)");
    new Window((Frame)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window)");
    new Window((Window)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");

    sm.prepare("Window(Window,GraphicsConfiguration)");
    new Window((Window)null, (GraphicsConfiguration)null);
    sm.assertChecked(AWTPermission.class, "showWindowWithoutWarningBanner");
}
 
Example 15
Source File: EventLock.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Similar to {@link EventQueue#invokeLater} but posts the event at the same
 * priority as paint requests, to avoid bad visual artifacts.
 */
static void invokeLaterLowPriority(RWLock m, Runnable r) {
    Toolkit t = Toolkit.getDefaultToolkit();
    EventQueue q = t.getSystemEventQueue();
    q.postEvent(new PaintPriorityEvent(m, t, r, null, false));
}