Firing Custom Events from Custom Components

Firing standard AWT events from custom components is relatively straightforward, as we've seen above. However, implementing custom events and firing them from a custom component is a little trickier. We'll outline the steps involved and then, for the sake of illustration, develop a custom component that fires custom events for the sake of illustration.

A Not-So-Contrived Scenario

Let's say that you've been tasked with developing a tree control similar to what you'd find in the Windows 95 Explorer application. For those of you unfamiliar with the Explorer, take a look at Figure 9-16. (A future version of the AWT will provide such a component.)

Figure 9-16. The Windows 95 Explorer Tree Control.

Being ...

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.