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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.