The Clipboard Class

java.awt.datatransfer.Clipboard is an extremely simple class. There are only three things you can do to a clipboard, other than construct one, as you can see from Table 20-2: get the name of the clipboard, set the contents of the clipboard, and retrieve the current contents of the clipboard. Notice that there is no setName method—setting the name of the clipboard is done at construction time. Furthermore, you can either create a local clipboard via the Clipboard constructor or you can obtain a reference to the system clipboard by invoking Toolkit.getSystemClipboard().

Table 20-2. java.awt.datatransfer.Clipboard Public Methods
Method Description
String getName() Returns the name of the clipboard
void setContents(Transferable, ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.