Creating an Example Program

It's time to get down to business and create some programs that use the clipboard techniques discussed so far. The first program you'll build uses a private clipboard. It copies or cuts data from a TextField object in response to the Copy and Paste buttons. When the user clicks the Paste button, any text in the clipboard is transferred into the read-only TextField object.

Listing 11.2 shows you the source code. Take a look at it and then read the explanation that follows.

Listing 11.2 Source Code for the PrivateClipboard Program That Demonstrates Using a Private Clipboard
 import*; import java.awt.*; import java.awt.datatransfer.*; import java.awt.event.*; import javax.swing.*; public class PrivateClipboard ...

Get JavaBeans Unleashed now with O’Reilly online learning.

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