use of java.awt.AWTPermission in project jdk8u_jdk by JetBrains.
the class SecurityManager method checkAwtEventQueueAccess.
/**
* Throws a <code>SecurityException</code> if the
* calling thread is not allowed to access the AWT event queue.
* <p>
* This method calls <code>checkPermission</code> with the
* <code>AWTPermission("accessEventQueue")</code> permission.
* In the case of subset Profiles of Java SE that do not include the
* {@code java.awt} package, {@code checkPermission} is instead called
* to check the permission {@code java.security.AllPermission}.
*
* <p>
* If you override this method, then you should make a call to
* <code>super.checkAwtEventQueueAccess</code>
* at the point the overridden method would normally throw an
* exception.
*
* @since JDK1.1
* @exception SecurityException if the calling thread does not have
* permission to access the AWT event queue.
* @deprecated The dependency on {@code AWTPermission} creates an
* impediment to future modularization of the Java platform.
* Users of this method should instead invoke
* {@link #checkPermission} directly.
* This method will be changed in a future release to check
* the permission {@code java.security.AllPermission}.
* @see #checkPermission(java.security.Permission) checkPermission
*/
@Deprecated
public void checkAwtEventQueueAccess() {
Permission perm = SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION;
if (perm == null) {
perm = SecurityConstants.ALL_PERMISSION;
}
checkPermission(perm);
}
use of java.awt.AWTPermission in project jdk8u_jdk by JetBrains.
the class Font2DTestApplet method init.
public void init() {
/// Check if necessary permission is given...
SecurityManager security = System.getSecurityManager();
if (security != null) {
try {
security.checkPermission(new AWTPermission("showWindowWithoutWarningBanner"));
} catch (SecurityException e) {
System.out.println("NOTE: showWindowWithoutWarningBanner AWTPermission not given.\n" + "Zoom window will contain warning banner at bottom when shown\n");
}
try {
security.checkPrintJobAccess();
} catch (SecurityException e) {
System.out.println("NOTE: queuePrintJob RuntimePermission not given.\n" + "Printing feature will not be available\n");
}
}
final JFrame f = new JFrame("Font2DTest");
final Font2DTest f2dt = new Font2DTest(f, true);
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
f.dispose();
}
});
f.getContentPane().add(f2dt);
f.pack();
f.show();
}
use of java.awt.AWTPermission in project jdk8u_jdk by JetBrains.
the class SecurityManager method checkSystemClipboardAccess.
/**
* Throws a <code>SecurityException</code> if the
* calling thread is not allowed to access the system clipboard.
* <p>
* This method calls <code>checkPermission</code> with the
* <code>AWTPermission("accessClipboard")</code>
* permission.
* In the case of subset Profiles of Java SE that do not include the
* {@code java.awt} package, {@code checkPermission} is instead called
* to check the permission {@code java.security.AllPermission}.
* <p>
* If you override this method, then you should make a call to
* <code>super.checkSystemClipboardAccess</code>
* at the point the overridden method would normally throw an
* exception.
*
* @since JDK1.1
* @exception SecurityException if the calling thread does not have
* permission to access the system clipboard.
* @deprecated The dependency on {@code AWTPermission} creates an
* impediment to future modularization of the Java platform.
* Users of this method should instead invoke
* {@link #checkPermission} directly.
* This method will be changed in a future release to check
* the permission {@code java.security.AllPermission}.
* @see #checkPermission(java.security.Permission) checkPermission
*/
@Deprecated
public void checkSystemClipboardAccess() {
Permission perm = SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION;
if (perm == null) {
perm = SecurityConstants.ALL_PERMISSION;
}
checkPermission(perm);
}
Aggregations