The System Clipboard

As you can see in Figure 20-1, our first applet contains a textfield, a textarea, and two buttons. After text is typed into the textfield, activating the Copy To System Clipboard button places the textfield's text onto the system clipboard. Subsequently, activating the “Paste From System Clipboard” button retrieves the text currently on the clipboard and places it in the textarea.

Figure 20-1. Copying a String to the System Clipboard. Activating the Copy To System Clipboard button copies the text from the textfield and places it on the system clipboard.

Before listing the applet in its entirety, let's take a look at the code ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.