Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4394691

Keyboard accelerator string not translated in non-English languages

XMLWordPrintable

      This is actually a J2SE bug.
      Elizabeth

      Name: boT120536 Date: 12/04/2000


      J2EE (build 1.3.0-C)

      1. Run the following program.

      2.

      import javax.swing.*;
      import java.awt.event.*;
      import java.util.*;


      public class I18NBug extends JFrame {
         public I18NBug() {
            setTitle("I18NBug");
            setBounds(30, 30, 600, 300);
            JMenuBar mb = new JMenuBar();
      makeMenu(mb);
      setJMenuBar(mb);
         }
            public void makeMenu(JMenuBar mb) {
              JMenu menu = new JMenu("Menu");
              JMenuItem prItem = null;
              prItem = new JMenuItem("Cancel");
      ActionListener al = new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
      System.out.println("Cancel!");
      }
              };
              prItem.addActionListener(al);
      Locale currentLocale = new Locale("fr","FR");
      setLocale(currentLocale);
      KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
              prItem.setAccelerator(ks);
              menu.add(prItem);
              mb.add(menu);
           }
         public static void main(String[] args) {
            I18NBug w = new I18NBug();
            w.setVisible(true);
         }
      }

      3. Since the text string for VK_ESCAPE is supplied by Java, it should use
          French when the locale is set to France.
      (Review ID: 110263)
      ======================================================================
      elizabeth.williams@eng 2000-12-21

            svioletsunw Scott Violet (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: