?
Solved

Problem on internationalization

Posted on 2004-09-17
6
Medium Priority
?
197 Views
Last Modified: 2010-03-31

Hi, I have problem in understanding the code, can somebody help me?

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class example3 extends Applet implements ItemListener
{
    Locale l;
    TextArea ta;
 
     

    public Insets getInsets ()
    {
        return new Insets (5, 5, 5, 5);
    }
   
    public void init ()
    {
         
        setLayout (new BorderLayout ());
        ta = new TextArea ();
        add ("North", ta);
        Panel p = new Panel ();
        p.add (new Label ("Language: "));        

        // Choice is the AWT equivalent of a JComboBox

        Choice languages = new Choice ();
        languages.addItem ("English");
        languages.addItem ("French");
        languages.addItem ("German");
        languages.addItem ("Italian");
        p.add (languages);
       
        languages.addItemListener (this);
 
        p.setBackground (Color.green);

        // Add languages label and choice list panel to bottom of applet object's border area.

        add ("South", p);

        l = new Locale ("en", "US");
 
        populate ();

        // Set default focus to the ComboBox

        languages.requestFocus ();
        setBackground (Color.green.darker ());
    }

     public void itemStateChanged (ItemEvent e)
    {
        if (e.getStateChange () == ItemEvent.SELECTED)
        {
            // Obtain languages item (English, French, German).

            String language = (String) e.getItem ();

           //TODO
           // a) compare variable language with the 4 hardcoded strings used
            //   in creating the comboBox
           // b) create the locale object passing in 2 arguments, language and Country
            //   these must match the suffixes in the ResourceBundle, "ex"
            //c) see the sample code given out during lecture
           
            populate ();
        }
    }

     

    private void populate ()
    {
         //TODO
        // a) get the resourceBundle for the particular locale
        // b) create a new StringBuffer
        // c) append the Key "Hello" & the corresponding term
        // d) append the key "Goodbye" & the correponding term
        // e) convert the StringBuffer to a string. Put the string into
        // f) TextArea
    }
}
0
Comment
Question by:jonathon1751
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 12085090
>> //c) see the sample code given out during lecture
;°)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12085096
It's a Locale chooser ;-)

What is it you don't understand?
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12085101
>> Hi, I have problem in understanding the code, can somebody help me?
What code exactly?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 37

Expert Comment

by:zzynx
ID: 12085117
If you expect use to do the ... TODO's
well, we're not allowed to.
First try yourself. If you have problems with your code, then we can help
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 750 total points
ID: 12085191
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12086064
8-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question