O'Reilly logo

JavaBeans Unleashed by Rick Leinecker, Dr. Donald Doherty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 com.sun.java.swing.*; import java.awt.*; import java.awt.datatransfer.*; import java.awt.event.*; import javax.swing.*; public class PrivateClipboard ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required