コード例 #1
0
ファイル: Beans.java プロジェクト: java66liu/classlib6
 /**
  * Used to indicate whether of not we are running in an environment where GUI interaction is
  * available.
  *
  * <p>Note that this method is security checked and is not available to (for example) untrusted
  * applets. More specifically, if there is a security manager, its <code>checkPropertiesAccess
  * </code> method is called. This could result in a SecurityException.
  *
  * @param isGuiAvailable True if GUI interaction is available.
  * @exception SecurityException if a security manager exists and its <code>checkPropertiesAccess
  *     </code> method doesn't allow setting of system properties.
  * @see SecurityManager#checkPropertiesAccess
  */
 public static void setGuiAvailable(boolean isGuiAvailable) throws SecurityException {
   SecurityManager sm = System.getSecurityManager();
   if (sm != null) {
     sm.checkPropertiesAccess();
   }
   guiAvailable = isGuiAvailable;
 }
コード例 #2
0
ファイル: Beans.java プロジェクト: java66liu/classlib6
 /**
  * Used to indicate whether of not we are running in an application builder environment.
  *
  * <p>Note that this method is security checked and is not available to (for example) untrusted
  * applets. More specifically, if there is a security manager, its <code>checkPropertiesAccess
  * </code> method is called. This could result in a SecurityException.
  *
  * @param isDesignTime True if we're in an application builder tool.
  * @exception SecurityException if a security manager exists and its <code>checkPropertiesAccess
  *     </code> method doesn't allow setting of system properties.
  * @see SecurityManager#checkPropertiesAccess
  */
 public static void setDesignTime(boolean isDesignTime) throws SecurityException {
   SecurityManager sm = System.getSecurityManager();
   if (sm != null) {
     sm.checkPropertiesAccess();
   }
   designTime = isDesignTime;
 }
コード例 #3
0
 private static Border getNoFocusBorder() {
   if (System.getSecurityManager() != null) {
     return SAFE_NO_FOCUS_BORDER;
   } else {
     return noFocusBorder;
   }
 }
コード例 #4
0
 public Insets getBorderInsets(Component c) {
   if (System.getSecurityManager() != null) {
     return SAFE_EDITOR_BORDER_INSETS;
   } else {
     return editorBorderInsets;
   }
 }
コード例 #5
0
ファイル: JPopupMenu.java プロジェクト: benzonico/ruling_java
 /**
  * Checks that there are enough security permissions to make popup "always on top", which allows
  * to show it above the task bar.
  */
 static boolean canPopupOverlapTaskBar() {
   boolean result = true;
   try {
     SecurityManager sm = System.getSecurityManager();
     if (sm != null) {
       sm.checkPermission(SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION);
     }
   } catch (SecurityException se) {
     // There is no permission to show popups over the task bar
     result = false;
   }
   return result;
 }
コード例 #6
0
ファイル: RecordingFrame.java プロジェクト: bitfauna/paragent
 public static boolean checkSecurity() {
   SecurityManager security = System.getSecurityManager();
   if (security != null) {
     try {
       security.checkPropertyAccess("user.dir");
       security.checkPropertyAccess("file.separator");
     } catch (SecurityException e) {
       System.out.println("SecurityManager restricts session recording.");
       return false;
     }
   }
   return true;
 }
コード例 #7
0
ファイル: PermissionTest.java プロジェクト: wangwg2/javalearn
 public void append(String text) {
   WordCheckPermission p = new WordCheckPermission(text, "insert");
   SecurityManager manager = System.getSecurityManager();
   if (manager != null) manager.checkPermission(p);
   super.append(text);
 }