// CalendarApplet.java: Display a locale-sensitive calendar package chapter14; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import java.util.*; import java.text.DateFormat; public class CalendarApplet extends JApplet implements ItemListener, ActionListener { // Create a CalendarPanel for showing calendars private CalendarPanel calendarPanel = new CalendarPanel(); // Combo box for selecting available locales private JComboBox jcboLocale = new JComboBox(); // Declare locales to store available locales private Locale locales[] = Calendar.getAvailableLocales(); // Buttons Prior and Next to displaying prior and next month private JButton jbtPrior = new JButton("Prior"); private JButton jbtNext = new JButton("Next"); /**Initialize the applet*/ public void init() { // Load native fonts. Uncomment the following two statements, // if native fonts such as Chinese fonts are used // GraphicsEnvironment ge = // GraphicsEnvironment.getLocalGraphicsEnvironment(); // ge.getAllFonts(); // Panel jpLocale to hold the combo box for selecting locales JPanel jpLocale = new JPanel(); jpLocale.setBorder(new TitledBorder("Choose a locale")); jpLocale.setLayout(new FlowLayout()); jpLocale.add(jcboLocale); // Initialize the combo box to add locale names for (int i=0; i