question: private void exportText ( ) { JFileChooser jc = new JFileChooser ( ) ; jc . setDialogTitle ( Msg . getMsg ( Env . getCtx ( ) , "ExportText" ) ) ; jc . setDialogType ( JFileChooser . SAVE_DIALOG ) ; jc . setFileSelectionMode ( JFileChooser . FILES_ONLY ) ; if ( jc . showSaveDialog ( this ) != JFileChooser . APPROVE_OPTION ) return ; try { BufferedWriter bout = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( jc . getSelectedFile ( ) ) ) ) ; bout . write ( textArea . getText ( ) ) ; bout . flush ( ) ; bout . close ( ) ; } catch ( Exception e ) { log . log ( Level . WARNING , e . getMessage ( ) ) ; } }
target:  Export Text to File