// Typical code to see if we have permission to do some "dangerous" thing
// in this case access the clipboard.
SecurityManager security = System.getSecurityManager();
if ( security != null )
    {
    // If we are an unsigned Applet, we need permission to look at the
    // clipboard, with Clipboard.getContents, but not to set it.
    try
        {
        security.checkSystemClipboardAccess();
        }
    catch ( SecurityException e )
        {
        err.println( "OS refused permission to look at the clipboard." );
        return null;
        }
     }