JDK-4400728 : JFileChooser constructors set incorrect default directory on Windows.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.3.1_01,1.4.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,linux,solaris_2.6
  • CPU: x86,sparc
  • Submitted: 2000-12-25
  • Updated: 2022-03-24
  • Resolved: 2001-03-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Description

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


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

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta FIXED IN: merlin-beta INTEGRATED IN: merlin-beta
14-06-2004

EVALUATION Documentation for the JFileChooser constructor needs to change. The correct behavior for the Wintel platform is to start in the user's "My Documents" folder. leif.samuelsson@Eng 2001-01-30 Name: aaR10142 Date: 01/31/2001 If you'd like to keep the new behavior of the constructor, please note, that it is an incompatible change, and should be approved by CCC ====================================================================== Correction to above evaluation: The default folder for Wndows is "My Documents" if it exists, otherwise it is the "Desktop" folder. This behavior was approved by the CCC. If this bug still appears to be reproducible, please give details on what default folder you are seeing. leif.samuelsson@Eng 2001-04-16
16-04-2001