Transforming an Applet into a Bean

Now you've gone over the design patterns you follow to create a bean, but what about all of those applets that you already wrote? Do you need to throw all of that work out and start all over to create beans? No! Java provides support for converting all of those Java applets into JavaBeans-compatible components. In this section, you convert a Java applet into a bean. Once you're finished you can convert all of your applets into beans.

You will convert a Java applet named LogoApplet (see Listing 4.1). LogoApplet displays business or company logos. In this case, it displays the Sams logo found in the samslogo.jpg file.

Listing 4.1 Source Code for LogoApplet.java
 package sams.applet; import java.awt.Graphics; ...

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.