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

PIT: JFileChooser hangs when navigating through the sub dirs

XMLWordPrintable

    • b41
    • generic, x86, sparc
    • generic, solaris_2.6, solaris_10, windows_98, windows_nt, windows_2000, windows_xp
    • Verified

      I am trying to print some print data to a file through the cross-platform print dialog. I am selecting 'PrintToFile' option in the print dialog and clicking 'OK'. A file dialog pops up. File dialog shows the current directory where the application is executed. I am opening a sub-directory. This sub-dir contains few files and the first file listed in the dir is selected by default. Now I am unable to navigate to any other directory nor change the file name. The file dialog just hangs there. I am unable to navigate to any other folder.

      I have noticed the following when comparing the behavior with the previous build:

      1. On the previous build this works fine.
      2. On the PIT build, navigating to a sub-dir that has only files (not dir) makes the first file selected by default.
      3. If the visited sub-dir contains another dir, that dir is shown as selected and file dialog does not hang.
      4. Once the first file in the visited dir is selected by default, i am unable to change it to a diff file name. Even if I specify a new file name, it still shows an overwrite warning dialog saying the file already exists. So it does not take the new file name.

      This is noticed only on the following PIT build, on all platforms:
      java version "2d.pit-jcg-sparc-01-2004-01-18.tiger"
      Java(TM) 2 Runtime Environment, Standard Edition (build 2d.pit-jcg-sparc-01-2004-01-18.tiger)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b33, mixed mode)

      This is not reproducible on Tiger-b32a. I tested this on Win XP, Solaris 9(GNOME).

      I have attached a tar file. Untar it and you will find an app - PrintDlgApp.java. Execute the application. A print dialog will pop up. Click the 'PrintToFile' option. A file dialog will appear showing a dir 'output'. Open the 'output' dir. Inside the output dir, you would find 2 ps files out of which the first one will be shown as selected. Now try coming back to the parent folder by clicking the 'UP' icon or by choosing from the drop-down. If nothing happens and if you still remain in the same dir, the bug is reproduced.

      -----------------------------------------------
      ###@###.### 2004-02-23

      Same problem reported by a CAP member:

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b38)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b38, mixed mode)

      Does this problem occur on J2SE 1.3, 1.4 or 1.4.1? Yes / No (pick one)
        No, works fine with build32c.

      Operating System Configuration Information (be specific):
        Windows 2000 Professional SP2
        Redhat 9.0

      Hardware Configuration Information (be specific):
        Custom built Athlon 600MHz, TNT2 AGP, 384MB

      Bug Description:
        A JFileChooser with its FileSelectionMode set to DIRECTORIES_ONLY or
        FILES_AND_DIRECTORIES will not respond to attempts to change directory
        via the 'Look in:' drop-down or the 'Up one level' button.

        The behaviour seems to have changed at some point after b32c and is
        evident in both b36 and b38.

      Steps to Reproduce (be specific):
        Compile and run the following class, then attempt to select a different
        directory using the 'Look in:' drop-down or the 'Up one level' button.


      JFileChooserTest.java
      =====================

      import javax.swing.JFileChooser;

      public class JFileChooserTest {

              public static void main(String[] args) {

                      JFileChooser fc = new JFileChooser();
                      fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                      fc.showOpenDialog(null);
              }
      }

      --------------------------------------------------------

      ###@###.### 2004-03-08

      Same problem reported by another CAP member:

      J2SE Version (please include all output from java -version flag):
        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b40)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b40, mixed mode)

      Does this problem occur on J2SE 1.3.x or 1.4.x?
        No
        
      Operating System Configuration Information (be specific):
        Metal look and feel

      Hardware Configuration Information (be specific):
        not hardware specific

      Bug Description:
        The file which set with setSelectedFile() method
        does not displayed in the file name field
        display other file ( the 1st file in a directory )
        and can not change directory.

      Steps to Reproduce (be specific):

      run following program

      //-------------- JFileChooserBug2.java ------------------------------
      import javax.swing.*;
      import java.io.*;

      class JFileChooserBug2 {
         public static void main(String[] args) {
           JFileChooser jfc = new JFileChooser();

           File file = new File(
           "c:\\Program Files\\Java\\j2re1.5.0\\bin\\client\\Xusage.txt" );
           jfc.setSelectedFile( file );

           int ret = jfc.showOpenDialog( null );
           System.exit(0);
         }
      }
      //-------------------------------------------------------------------


            kereminsunw Konstantin Eremin (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: