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

JFileChooser Icon placement does not match native OS

XMLWordPrintable



      Name: sv35042 Date: 10/08/2002


      FULL PRODUCT VERSION :
      C:\javasdk\j2sdk1.4.0>cd bin

      C:\javasdk\j2sdk1.4.0\bin>java -version
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      C:\javasdk\j2sdk1.4.0\bin>

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]
      (C) Copyright 1985-2000 Microsoft Corp.

      C:\>ver

      Microsoft Windows 2000 [Version 5.00.2195]

      C:\>

      A DESCRIPTION OF THE PROBLEM :
      When traversing the Entire Network using JFileChooser, you
      will notice that the Directory Icon and text are above the
      Microsoft Windows Network icon and text. In the native
      file chooser from any of the native Microsoft products you
      will notice that the Microsoft Windows Network Icon is at
      the top, and the Directory Icon is underneath. This causes
        User confusion between the 2 environments.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Open a JFileChooser Box
      2.Select My network places
      3.Select Entire Network

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I Expected to see the
      1. Microsoft Windows Network Icon and text
      2. Directory Icon and text.

      I saw both Icons and text, however they were in reverse
      order.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      void cmdBrowse_actionPerformed(ActionEvent e)
      {
      // clear fields
      txtFilename.setText("");
      txtData.setText("");
      try
      {
      // show a file browser to get the XML file of
      synthesized oligos
      JFileChooser fileDlg = new JFileChooser(".");
      fileDlg.setDialogTitle("Open DNA Sample Data File");
      fileDlg.setSelectedFile(new File("*.txt"));
      fileDlg.setFileSelectionMode(JFileChooser.FILES_ONLY);
      int ret = fileDlg.showOpenDialog(this);
      if( ret == JFileChooser.CANCEL_OPTION )
      { // user cancelled
      return;
      }
      // on return, get selected file
      File file = fileDlg.getSelectedFile();
      String filename = file.getPath();
      filename = filename.replace('\\','/');
      txtFilename.setText(filename);
      fileDlg.hide();
      fileDlg = null;
      if( file.exists() == false )
      {
      complain("Could not find DNA sample data file "
      + filename,null);
      return;
      }

      // try to parse the selected file as XML
      // -- if failure, simply display as text
      String sFile = null;
      Node nodFile = null;
      String requestId = null;
      String xmlFile = "file:///" + file.getPath();
      try
      {
      BufferedReader reader = new BufferedReader(new
      FileReader(file));
      StringBuffer buff = new StringBuffer(100000);
      while( reader.ready())
      {
      buff.append(reader.readLine());
      buff.append("\n"); // new line
      }// next line
      // at exit, buff holds contents of file
      sFile = buff.toString();
      nodFile = Node.parse(sFile);
      txtData.setText("DNA sample data file:\n\n" +
      nodFile.treeToString());
      }
      catch(Exception ex)
      {
      complain("File does not appear to be in the
      expected tab-delimited format for a DNA sample data file.\n"
      + "Opening file
      as text only.", null);
      txtData.setText(sFile); // can't parse, so
      just show
      }

      txtData.setCaretPosition(0); // top
      txtData.setEditable(false);
      loadCombos(file);
      }
      catch(Exception ex)
      {
      complain("Problem encountered while attempting to
      import DNA sample data from file",ex);
      }
      }

      ---------- END SOURCE ----------
      (Review ID: 139942)
      ======================================================================

            Unassigned Unassigned
            svioletsunw Scott Violet (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: