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

File Dialog is not I18N in Linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2_06
    • client-libs
    • x86
    • linux

      1.Set locale to French
      2.Open a FileDialog
      3.All strings are in English

      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;
      import java.io.File;
      import java.io.FileInputStream;

      import java.awt.Dimension;
      import java.awt.*;
      import java.util.Locale;

      public class FileDialogTest
      {
        public static void main(String s[])
        {
          load();
          System.exit(0);
        }
       
      // Opens a file
      public static void load() {
        Frame frame = new Frame();
        FileDialog fd = new FileDialog(frame, "Oracle.com", FileDialog.LOAD);
        fd.setLocale(Locale.FRENCH);
        Locale.setDefault(Locale.FRENCH);
        fd.show();
        String filename = fd.getDirectory()+ fd.getFile();
        File f = new File(filename);
        int size = (int)f.length();
        int bytes_read = 0;
        if (filename != null) {
          try {
            FileInputStream fis = new FileInputStream(filename);
            byte[] data = new byte[size];
            
            while (bytes_read < size)
              bytes_read += fis.read(data, bytes_read, size-bytes_read);
              
            
            TextArea ta = new TextArea();
            frame.add(ta);
            ta.setText(new String(data));
            frame.setTitle(fd.getFile());
            frame.addWindowListener
            (new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                   System.exit(0);
                   }
                }
            );
            
            frame.pack();
            frame.show();
          }
          catch (Exception e) {
            System.out.println(e);
          }
        }
      }
       
      }
      ###@###.### 2005-1-27 23:34:42 GMT

            yan Yuri Nesterenko
            mmma Marvin Ma (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: