O'Reilly logo

JavaBeans Unleashed by Rick Leinecker, Dr. Donald Doherty

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

Writing the GlobalBean Bean

We will now write an internationalized bean, named GlobalBean, shown in Listing 26.6. GlobalBean is subclassed from Java's Panel class. It displays a list of locales in a List object and a greeting in a Label object. Its default locale is English (United States). Double-click any of the five locales in the list that GlobalBean supports and the greeting for the appropriate locale displays in the Label object.

Write the GlobalBean class so that it implements the ActionListener interface. You register the GlobalBean object as an action event listener with the Label object so users can select the locale through the list displayed in the Label object. You do this in the GlobalBean class constructor. All the bean's code ...

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