Creating an Image Button Bean

The Picture bean is useful, but, with some additional modifications, you can make it even more useful. You can turn it into an image button bean. Image buttons are popular components in toolbars where there's usually no room for text to be displayed. In this section, you modify the Picture bean code to transform it into code for an image button bean named PictureButton.

Picture Bean as Button

You might be surprised by the amount of "button" functionality already in the Picture bean. The Picture bean is derived from Java's Canvas class, which is derived from the Component class. The Component class, which is part of the java.awt package, already contains most of the event handling mechanisms used by graphic user interface ...

Get JavaBeans Unleashed 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.