question: private void saveAttachmentToFile ( ) { int index = cbContent . getSelectedIndex ( ) ; log . info ( "index=" + index ) ; if ( m_attachment . getEntryCount ( ) < index ) return ; String fileName = getFileName ( index ) ; String ext = fileName . substring ( fileName . lastIndexOf ( '.' ) ) ; log . config ( "Ext=" + ext ) ; JFileChooser chooser = new JFileChooser ( ) ; chooser . setDialogType ( JFileChooser . SAVE_DIALOG ) ; chooser . setDialogTitle ( Msg . getMsg ( Env . getCtx ( ) , "AttachmentSave" ) ) ; File f = new File ( fileName ) ; chooser . setSelectedFile ( f ) ; int returnVal = chooser . showSaveDialog ( this ) ; if ( returnVal != JFileChooser . APPROVE_OPTION ) return ; File saveFile = chooser . getSelectedFile ( ) ; if ( saveFile == null ) return ; log . config ( "Save to " + saveFile . getAbsolutePath ( ) ) ; m_attachment . getEntryFile ( index , saveFile ) ; }
target:  Save Attachment to File