il codice diverebbe questo giusto????
codice:
JFileChooser chooser = new JFileChooser ();
chooser.removeChoosableFileFilter (chooser.getAcceptAllFileFilter ());
chooser.addChoosableFileFilter (new FileNameExtensionFilter ("Documento Acrobat Reader", "pdf"));
int returnVal = chooser.showSaveDialog(jPanel);
String destinazione;
if(returnVal==JFileChooser.APPROVE_OPTION){
File fFile = chooser.getSelectedFile ();
if (fFile.exists ()) {
int response = JOptionPane.showConfirmDialog (jInserimentoprog,
"Sovrascrivere il file esistente?","Conferma sovrascrittura",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.CANCEL_OPTION) {
destinazione=null;
}else{
destinazione=fFile.getPath();
}
}else{
destinazione =fFile.getPath() + ".pdf";
FileInputStream fis = new FileInputStream("miofile.pdf");
FileOutputStream fos = new FileOutputStream(destinazione);
byte[] buf = new byte[1024];
int n;
while ((n = fis.read(buf)) != -1)
fos.write(buf, 0, n);
}
}else{
destinazione=null;
}