Open Jfilechooser with filled "File Name" field

Asked

Viewed 595 times

2

How can I open Jfilechooser with the field "File Name" filled?

This field of the image below:

Imagem do campo que quero abrir preenchido com algum nome

How to set a name to open as default in this field?

  • Managed to solve the problem with the posted answer?

1 answer

1

You need to use the method setSelectedFile

JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setSelectedFile(new File("fileToSave.txt"));
jFileChooser.showSaveDialog(parent);

Source

Browser other questions tagged

You are not signed in. Login or sign up in order to post.