import java.io.File;
import java.util.Scanner;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
/*
 * ScannerTextFileWithTextAreaIO.java
 *
 * Created on January 7, 2005, 1:21 PM
 */

/**
 *
 * @author Bill Kraynek
 */
public class ScannerTextFileWithTextAreaIO {
       
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception {
        // the file being read must be in the parent folder of the src folder
        Scanner fileScanner = new Scanner(new File("src/ScannerTextFileWithTextAreaIO.java"));
        //fileScanner.useDelimiter(" ");
        String out = "";
        while( true ) {
            if( !fileScanner.hasNext() ) break;
            // the default delimiter for next is whitespace
            out += fileScanner.next() + "\n";
        } // end while
        JTextArea outArea = new JTextArea(out,20,30);
        JOptionPane.showMessageDialog(null,new JScrollPane(outArea));
    } // end main
    
}

