Hi :)
So, I have text on a textpane.
When i hit the save button i want to know if the file already exists on the disk because in that case i want to "update" that file and if that file does not exists I want to create it with the text which is inside the textpane.
When the the first hit on the save button will be this :
Code Java:if(fileChooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) return; File f = fileChooser.getSelectedFile(); if(f == null) return; try{ FileOutputStream fout = new FileOutputStream(f); rtf.write(fout, textArea.getDocument(), 0, textArea.getDocument().getLength()); } catch(IOException e) {} catch(BadLocationException e) {} catch(NullPointerException e) {} frame.setTitle(fileChooser.getSelectedFile().getName()); }
Ok, now I know that the file exists on the disc because with the code that i posted the final user saved it.
The second hit in the same save button will just do the "update" of the file (modifications, etc).
How can I do it ?
Any tips please ?
