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 ...

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.