public boolean setClipboardContents ( Transferable data ) { if ( data == null ) return false ; if ( ( clipboardWriteStatus & CLIPBOARD_DISABLED ) == CLIPBOARD_DISABLED ) return false ; // Rejected it last time, don't ask again clipboardWriteStatus = CLIPBOARD_ENABLED ; if ( cs == null ) { try { cs = ( ClipboardService ) ServiceManager . lookup ( "javax.jnlp.ClipboardService" ) ; } catch ( UnavailableServiceException e ) { cs = null ; } } if ( cs != null ) { // set the system clipboard contents to a string selection try { cs . setContents ( data ) ; clipboardWriteStatus = CLIPBOARD_ENABLED ; return true ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } return false ; }
Set the global clipboard contents .