question: private void importText ( ) { JFileChooser jc = new JFileChooser ( ) ; jc . setDialogTitle ( Msg . getMsg ( Env . getCtx ( ) , "ImportText" ) ) ; jc . setDialogType ( JFileChooser . OPEN_DIALOG ) ; jc . setFileSelectionMode ( JFileChooser . FILES_ONLY ) ; if ( jc . showOpenDialog ( this ) != JFileChooser . APPROVE_OPTION ) return ; StringBuffer sb = new StringBuffer ( ) ; try { InputStreamReader in = new InputStreamReader ( new FileInputStream ( jc . getSelectedFile ( ) ) ) ; char [ ] cbuf = new char [ 1024 ] ; int count ; while ( ( count = in . read ( cbuf ) ) > 0 ) sb . append ( cbuf , 0 , count ) ; in . close ( ) ; } catch ( Exception e ) { log . log ( Level . WARNING , e . getMessage ( ) ) ; return ; } textArea . setText ( sb . toString ( ) ) ; updateStatusBar ( ) ; }
target:  Import Text from File