save with extension

G

Guest

I have following code:

JFileChooser fc = new JFileChooser();
fc.setFileFilter(/* my class*/ new ExtensionFileFilter("html", "HTML
File"));
int returnVal = fc.showSaveDialog(m);
if(returnVal != JFileChooser.APPROVE_OPTION) return;
.......

with second line I force dialog to show only html files.
But I want, when I choose file e.g. "out" then I want final file will be
"out.html" and if I choose "file.html" the final file will be "file.html"

Is this possible with JFileChooser, or I must write 2 or 3 lines of code?
 
A

Ann

I have following code:

JFileChooser fc = new JFileChooser();
fc.setFileFilter(/* my class*/ new ExtensionFileFilter("html", "HTML
File"));
int returnVal = fc.showSaveDialog(m);
if(returnVal != JFileChooser.APPROVE_OPTION) return;
......

with second line I force dialog to show only html files.
But I want, when I choose file e.g. "out" then I want final file will be
"out.html" and if I choose "file.html" the final file will be "file.html"

Is this possible with JFileChooser, or I must write 2 or 3 lines of code?

Did you try it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top