O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

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

Copying Images to a Clipboard

As we have seen, manipulating clipboards is relatively straightforward. Perhaps the most difficult aspect of the clipboard/data transfer mechanism is copying data other than text to a clipboard, and even that is not rocket science, especially once you get you've gotten the hang of it.

ImageSelection—A Transferable for Encapsulating Images

The first order of business is to develop a class that implements Transferable and encapsulates an image. Our first version of such a class will offer a lone data flavor for representing the image—java.awt.Image. A little later on, we'll add another data flavor for good measure.

We'll follow the naming convention established by StringSelection and name our class ImageSelection

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