Hi !!

I try to save some things on a form to a file I use the filechooser object,
but I donīt no file extension, I have a filter for htm-files only,
file.getAbsolutePath(); for example returns c:\test and not c:\test.htm
like i want it to, can someone help me with this. Here is my code, thanx
Pelle

private void saveToFile() {
String s = "";
clsFCFilter filter = new clsFCFilter();

filter.addExtension("htm");
filter.setDescription("HTML-filer");

fc.setFileFilter(filter);

fc.setDialogTitle("Frageladan 2 - Spara som HTML");
int returnVal = fc.showSaveDialog(this);

if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();

System.out.println(fc.getName());
System.out.println(file.getAbsolutePath());
try {
file.createNewFile();

BufferedWriter out = new BufferedWriter(new FileWriter(file));
s = "<html><head><title>" + lblTitle.getText() +
"</title></head><body><font face=verdana><h2>Frageladan 2</h2>";
out.write(s, 0, s.length());
s = "<table width=400><tr><td bgcolor= navy><font size=1
color=#ffffff><b>" + lblTitle.getText() + "</b></font></td></tr>";
out.write(s, 0, s.length());
s = "<tr><td align=right><font size=1><b>" + lblUserName.getText() +
"</b></font></td><td align=right><font size=1></font></td></tr>";
out.write(s, 0, s.length());
s = "<tr><td valign=top ><font size=1>" + txtText.getText() +
"</font></td></tr><tr><td>&nbsp;</td></tr>";
out.write(s, 0, s.length());

for(int i = 0; i < listModel.getSize(); i++) {
comView = (tblCommentOverView) listModel.getElementAt(i);
s = "<tr><td align=right bgcolor=#dcdcdc><font size=1><b>" +
comView.fldUserName + " " + df.format(comView.fldDate) +
"</b></font></td></tr>";
out.write(s, 0, s.length());
s = "<tr><td><font size=1>" + comView.fldText + "</font></td></tr>";
out.write(s, 0, s.length());
}
s = "<font></body></table></html>";
out.write(s, 0, s.length());
out.close();
}
catch(IOException e){
JOptionPane.showMessageDialog(this,e.getMessage(),"faen oxå!!",
JOptionPane.INFORMATION_MESSAGE);
}
}
}