Transferring Custom AWT Components

Our final example, at the risk of beating data transfer to death, is to implement a transferable that encapsulates a custom component.

Note: A there is a bug under the 1.2 release of the AWT that causes the following applet to throw an exception under Windows NT (it works fine under Solaris).

A Transferable for Encapsulating a Custom Component

Our custom component will be a very simplistic image button, whose implementation we won't bother to discuss. Instead, we will simply show the implementation of ImageButtonSelection and the applet that exercises it. The complete implementation of ImageButtonSelection is listed in Example 20-5.

Example 20-5. ImageButtonSelection Class Listing
 import java.awt.*; import ...

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.