Name

AWT Permissions

Type

java.awt.AWTPermission

Name

There are six names supported by this class, as listed here:

accessClipboard

Allow access to the system’s global clipboard.

accessEventQueue

Allow direct access to the event queue.

createRobot

Allow code to create the AWT Robot class.

listenToAllAWTEvents

Allow code to listen directly to the event dispatcher.

readDisplayPixels

Allow AWT robots to read the pixels of the display.

showWindowWithoutWarningBanner

Allow window frames to be created without an identifying warning banner.

The accessEventQueue permission is a little unusual because of the way in which event queues are handled by most implementations of the virtual machine. Most implementations, including the appletviewer and the Java Plug-in, set up a separate event queue for each applet codebase. This means that an applet can use the methods of the event queue class to access its own event queue; the accessEventQueue permission does not need to be granted in that case. However, if you install the sandbox via a command-line argument, then this does not apply, and your code will need this permission in order to call methods of the event queue class.

All applications still need the listenToAllAWTEvents permission in order to register an event listener with the default toolkit.

Actions

None.

Examples

// Allow code to use the robot class fully
permission java.awt.AWTPermission "createRobot";
permission java.awt.AWTPermission "readDisplayPixels";

Get Java Security, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.