hi,
i have a TextField in myGUI where some data(results) are shown after calculation. I have a 'save' button to save this result into a particular txt file..
i almost done without error....but inside my txt file it shows this kind of things:
ava.awt.datatransfer.StringSelection@157f0dc
Please anybody help me to figure out...
else if (e.getSource()==saveButton){
int x=Integer.parseInt(inputField.getText());
String str=Integer.toString(x*x);
resultField.setText(str)
try {
// String selection =selection.getSelectedText();
String selection=resultField.getText();
StringSelection data= new StringSelection(selection);
File outFile= new File("c:/Java/math.txt");
FileOutputStream fos=new FileOutputStream(outFile);
PrintWriter pr=new PrintWriter(fos);
pr.print(data);
pr.close();}
catch (IOException ioe) {
ioe.printStackTrace();
System.exit(0);}