On Tue, 10 Mar 2026 18:42:12 GMT, Andy Goryachev <[email protected]> wrote:

>> That would be a noticeable behavior change. We could do what you suggest, 
>> but then the application wouldn't be able to tell that's what happened. As 
>> it is, the app can do what you suggest (catch the exception and set the 
>> dialog to the current dir) or something else (maybe a default location for 
>> the app).
>> 
>> I wouldn't want to change it without more discussion.
>
> I'd say the existing behavior is unexpected and wrong.  The use case where 
> FileChooser is used to save or open file(s) should not require the 
> application to invent additional code to handle transient directories, a 
> quite possible scenario.
> 
> For instance, Swing `JFileChooser` ignores the non-existent currentDirectory 
> and just uses the JVM's current one.
> 
> 
>     public static void main(String[] args) throws Throwable {
>         // enableLogging();
>         //Application.launch(TreeView_Focus_8256142.class, args);
>         EventQueue.invokeLater(AppTestLauncher::run);
>     }
>     
>     private static void run() {
>         JFrame f = new JFrame();
>         f.setSize(100, 100);
>         f.setVisible(true);
> 
>         JFileChooser c = new JFileChooser(new File("/blah"));
>         c.showOpenDialog(f);
>     }

what do other people think?  @hjohn @mstr2 @nlisker @crschnick

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2101#discussion_r2913772047

Reply via email to