hi karan
instead of going for filewriter , u can go for a FileOutputStream .
here's the code.
================
should be given within the constructor
Button save=new Button("Save");
save.addActionListener(this);
this code is for a save button .
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==save)
{
String s1,s2,s3;
FileDialog fd=new FileDialog(h,"Save",FileDialog.SAVE);
fd.show();
try
{
s1=fd.getDirectory();
s2=fd.getFile();
f1=new File(s1,s2);
FileOutputStream fos1=new FileOutputStream(f1);
s3=ta.getText();
byte b1[]=s3.getBytes();
fos1.write(b1);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}