need help with writing to file.

hi. I have one problem. my writen program code don't write to file. can anyone tell why.

class metodai{

public PrintWriter fl_ras(File fl_pav)throws IOException{

returnnew PrintWriter(new FileWriter(fl_pav));

}

//.....

publicvoid Saugo(PrintWriter R_wr, JComboBox ps){

// for output using R_wr.print("String wich I need to save to file");

//also have tried R_wr.println(); no much use

}

}

//.....

publicclass Pradziaextends JFrame{

//.....

Metodai met =new Metodai();

//.....

class sv_flimplements ActionListener{// taking action when button to save file is pressed

publicvoid actionPerformed(ActionEvent e){

try{

JFileChooser Fc =new JFileChooser();

Fc.setDialogTitle("Pasirinkite faila kuriame bus issaugoti rezultatai");

int r = Fc.showSaveDialog(Pradzia.this);

if (r == JFileChooser.APPROVE_OPTION){//kai pasirenkama 'Save'

R_wr = met.fl_ras(Fc.getSelectedFile());

met.Saugo(R_wr, psr);

}elseif (r == JFileChooser.CANCEL_OPTION){//kai pasirenkama 'Cancel'

txt.append("\n\nIssaugojimo faile atsisakyta\n--> Duomenys neissaugoti");

}elseif(r == JFileChooser.ERROR_OPTION){

txt.append("\n\n!!! --> nepasirinktas rezultatu failas arba klaida ji pasirenkant");

}

}catch (IOException ex){

txt.append("\n\n!!! --> Klaida atidarant rezultatu faila");

}

}

}

//.....

}

P.S. file was created but empty.

[3364 byte] By [Laurisa] at [2007-10-3 9:51:21]
# 1
[url] http://java.sun.com/docs/books/tutorial/essential/io/[/url]
bckrispia at 2007-7-15 5:08:40 > top of Java-index,Java Essentials,New To Java...
# 2
>file was created but empty.do you close the writer anywhere?
Michael_Dunna at 2007-7-15 5:08:40 > top of Java-index,Java Essentials,New To Java...
# 3
He never even writes to it. :P
bckrispia at 2007-7-15 5:08:40 > top of Java-index,Java Essentials,New To Java...
# 4
thnx. working.
Laurisa at 2007-7-15 5:08:40 > top of Java-index,Java Essentials,New To Java...