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

JFileChooser fails to identify RTL encoded directory name

    XMLWordPrintable

    Details

      Description

      Name: vr73486 Date: 11/04/99

      On hebrew enabled(98,95) windows machines, JFileChooser fails to
      recognize arabic named directories as directories. Instead, JFileChooser
      identifies these directories as files.

      On arabic enabled(98,95) windows machines, JFileChooser fails to
      recognize hebrew named directories as directories. Instead, JFileChooser
      identifies these directories as files.

      To reproduce the bug:
      Compile and run the code below.
      On windows 95(98)arabic, create a folder with arabic name
      Use jFileChooser application to read the drive containing that folder
      Note that it recognizes the directory (folder) correctly
      Go to windows 95(98) Hebrew and run jFileChooser application
      Read drive containing the arabic named directory
      Note that JFileCooser does not recognize that arabic named directory
      as a directory but it recognizes it as a file.

      ------
      /*
      Copyright (c) Sun Microsystems 1998

      $Header: /home/sun/src/JDK1.2/jFileChooser.java,v 1.6 1999/08/13 09:35:00 isam Exp $

      */

      import java.awt.*
      import java.awt.event.*
      import java.io.*
      import javax.swing.*

      public class jFileChooser extends JApplet
      {
              public void init()
              {
                      jFileChooser1 sfc = new jFileChooser1()
                      sfc.setVisible(true)
              }

              public static void main(String[] argv)
              {
                      jFileChooser1 sfc = new jFileChooser1()
                      sfc.setVisible(true)
              }

      }

      class jFileChooser1 extends JFrame
      {
              JFrame parent
              public jFileChooser1()
              {
                  super("\u0645\u062b\u0627\u0644")
                  setSize(350, 200)
                  parent = this
                  Container c = getContentPane()
                  c.setLayout(new GridLayout(10,1))

                  JButton openButton = new JButton("\u05d8\u05e2\u05df")
                  JButton saveButton = new JButton("\u05d0\u05d7\u05e1\u05df")
                  JButton dirButton = new JButton("\u0625\u062e\u062a\u0627\u0631")
                  final JLabel statusbar =
                  new JLabel("\u0645\u062b\u0627\u0644\u0020\u05d3\u05d2\u05de\u05d4 JFileChooser")
                  statusbar.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18))

                  openButton.addActionListener(new ActionListener()

                  {
                  public void actionPerformed(ActionEvent ae)
                  {
                      JFileChooser chooser = new JFileChooser()
                      int option = chooser.showOpenDialog(parent)
                      if (option == JFileChooser.APPROVE_OPTION)
                      {
                              statusbar.setText("You chose " +
                              ((chooser.getSelectedFile()!=null)?
                                    chooser.getSelectedFile().getName():
                                    "nothing"))
                      }
              else
              {
              // statusbar.setText("You canceled.")
              }
            }
          })

          saveButton.addActionListener(new ActionListener()
          {
          public void actionPerformed(ActionEvent ae)
          {
              JFileChooser chooser = new JFileChooser()
              int option = chooser.showSaveDialog(parent)
              if (option == JFileChooser.APPROVE_OPTION)
              {
                      statusbar.setText("You saved " +
                                  ((chooser.getSelectedFile()!=null)?
                                    chooser.getSelectedFile().getName():
                                    "nothing"))
              }
              else
              {
                      statusbar.setText("You canceled.")
              }
            }
          })

          dirButton.addActionListener(new ActionListener()
          {
              public void actionPerformed(ActionEvent ae)
              {
                      JFileChooser chooser = new JFileChooser()
                      chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
                      int option = chooser.showOpenDialog(parent)
                      if (option == JFileChooser.APPROVE_OPTION)
                      {
                              statusbar.setText("You opened " +
                                  ((chooser.getSelectedFile()!=null)?
                                    chooser.getSelectedFile().getName():
                                    "nothing"))
                      }
                      else
                      {
                              statusbar.setText("You canceled.")
                      }
              }
          })

          openButton.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18))
          saveButton.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18))
          dirButton.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 18))

          c.add(openButton)
          c.add(saveButton)
          c.add(dirButton)
          //c.add(statusbar)
        }
      }



      WorkAround:
      ======================================================================
      ###@###.### 10/13/04 18:46 GMT

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            vrosenmasunw Victor Rosenman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: