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

JFileChooser constructors set incorrect default directory on Windows.

XMLWordPrintable

    • beta
    • x86, sparc
    • generic, linux, solaris_2.6



      Name: aaR10142 Date: 12/25/2000



      JFileChooser constructors by default set current dirrectory to the "Desktop" value on Windows,
      but should use user.home property instead.

      javadoc says:
      "public JFileChooser()

           Constructs a JFileChooser pointing to the user's home
           directory.
      "

      See example

      ---------- CtorTests.java ----------------

      import javax.swing.*;

      public class CtorTests {

          public static void main(String argv[]) {

               JFileChooser c = new JFileChooser(); // Create JFileChooser object
               System.out.println("Current dir is "+c.getCurrentDirectory());
               System.out.println("Home dir is " + System.getProperty("user.home"));
          }
      }
      ------------- output -------------------------
      Current dir is Desktop
      Home dir is C:\WINNT\Profiles\fda


      ======================================================================

            leifs Leif Samuelsson (Inactive)
            alisunw Ali Ali (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: