net.rim.device.api.system
Class Clipboard

java.lang.Object
  extended by net.rim.device.api.system.Clipboard

public final class Clipboard
extends Object

Provides a global clipboard for cut and paste operations.

 // Retrieve the Clipboard object.
 Clipboard  cp = Clipboard.getClipboard();
 
 // Copy to clipboard.
 cp.put(str);
 
 // Retrieve the clipboard's current contents
 String str = (String) cp.get();
 
 // Clean the clipboard.
 cp.put(null);
 


Method Summary
 Object get()
          Retrieves the clipboard's current contents.
static Clipboard getClipboard()
          Retrieves the system's clipboard object.
 Object put(Object o)
          Copies an object to the clipboard.
 String toString()
          Retrieves string equivalent of clipboard's contents.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Method Detail

get

public Object get()
Retrieves the clipboard's current contents.

Notice that this get is not destructive: the clipboard remains loaded with this object until a new one gets put to replace it.

Returns:
Current object on the clipboard.

getClipboard

public static Clipboard getClipboard()
Retrieves the system's clipboard object.

Returns:
System clipboard.

put

public Object put(Object o)
Copies an object to the clipboard.

This operation replaces the existing object with your new one. Accordingly, you can clear out the clipboard by passing null into this method.

Note: This method throws a SecurityException if third-party applications provide an object other than a String or StringBuffer as parameter to this method.

Parameters:
o - New object to put on the clipboard.
Returns:
Previous contents of the clipboard.

toString

public String toString()
Retrieves string equivalent of clipboard's contents.

This method invokes toString() on the clipboard's current contained object. If the contents are null, then an empty string is returned.

Overrides:
toString in class Object
Returns:
String representation of the clipboard's current contents.





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.