// example2.java import java.applet.Applet; import java.awt.*; import java.util.*; public class example2 extends Applet { TextArea ta; // =============================================== // getInsets // // Return the layout margins of the four different // sides of the applet's panel container. By // default, these margins are set to 0. Setting // the margins to 5 pixels each gives us a nicer // looking applet. The panel container's layout // manager calls this method. // // Arguments: // // none // // Return: // // container's insets // =============================================== public Insets getInsets () { return new Insets (5, 5, 5, 5); } // ====================== // init // // Initialize the applet. // // Arguments: // // none // // Return: // // none // ====================== public void init () { // Set BorderLayout to be the applet's new layout manager (FlowLayout is the default). setLayout (new BorderLayout ()); // Create a text area object (which will hold locale information). ta = new TextArea (); // Add text area object to center of applet. add ("Center", ta); // Set the applet's background color. setBackground (Color.green.darker ()); // Obtain all currently available locales. Locale [] locales = Calendar.getAvailableLocales (); // Create a buffer for holding locale text. StringBuffer sb = new StringBuffer (); // Populate the buffer with locale text. for (int i = 0; i < locales.length; i++) sb.append (locales [i].getLanguage () + "_" + locales [i].getCountry () + "\t" + locales [i].getDisplayName () + "\n"); // Assign contents of buffer to text area. ta.setText (sb.toString ()); } }