Looking for Guidance with using a PrintWriter
<p>I am trying to read from one file and process results to a different file, but i am having difficulty with using PrintWriter. I know that everything works when I print to the console, but when I set the PrintWriter to a designated file using a JOFileChooser it will not write to or create the file. I am not sure where I am going wrong. Any help with this would be appreciated.</p>

<pre><code>import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;

import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class FileIntAdder extends JFrame implements ActionListener
{
     private JTextField txtFileIn;
     private JTextField txtFileOut;
     private JButton btnFileIn;
     private JButton btnFileOut;
     private JButton btnProcess;
     private JButton btnClear;
     public FileIntAdder()
    {
        this.setTitle("File I/O");   
        Container canvas = this.getContentPane();

        canvas.add(createCenterPanel(), BorderLayout.CENTER);
        canvas.add(createSouthPanel(), BorderLayout.SOUTH);


        this.setResizable(false);
        this.setSize(600, 150);
        this.setLocation(800, 500);
        this.setVisible(true);
        this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
    }

    private JPanel createSouthPanel()
        {
            JPanel pnlSouth = new JPanel();

            btnProcess = new JButton("Process");
            btnProcess.addActionListener(this);
            pnlSouth.add(btnProcess);

            btnClear = new JButton("Clear");
            btnClear.addActionListener(this);
            pnlSouth.add(btnClear);

            pnlSouth.setBackground(Color.DARK_GRAY);
            return pnlSouth;
        }

    private JPanel createCenterPanel()
        {

            JPanel pnlCenter = new JPanel();
            pnlCenter.setLayout(new GridLayout(2,2));

            btnFileIn = new JButton("File In");
            pnlCenter.add(PanelWrap(btnFileIn));
            btnFileIn.addActionListener(this);
            txtFileIn = new JTextField(25);
            pnlCenter.add(PanelWrap(txtFileIn));


            btnFileOut = new JButton("File Out");
            pnlCenter.add(PanelWrap(btnFileOut));
            btnFileOut.addActionListener(this);
            txtFileOut = new JTextField(25);
            pnlCenter.add(PanelWrap(txtFileOut));

            return pnlCenter;
        }

        public static void main(String[] args)
            {
                new FileIntAdder();
            }

        @Override
        public void actionPerformed(ActionEvent a)
            {
                JFileChooser fileInput = new JFileChooser();
                JFileChooser fileOutput = new JFileChooser();

                    if(a.getSource() == btnClear)

                        txtFileIn.setText("");
                        txtFileOut.setText("");

                    if(a.getSource() == btnFileIn)
                    {   

    if( fileInput.showOpenDialog(btnFileIn) != JFileChooser.CANCEL_OPTION)
                        {
            File inFile = fileInput.getSelectedFile(); 
                String fileInName =  inFile.getAbsolutePath();
                                                                              txtFileIn.setText(fileInName);
                        }
                    }
                    if(a.getSource() == btnFileOut)
                    {
    if(fileOutput.showSaveDialog(btnFileOut) != JFileChooser.CANCEL_OPTION)
                        {
                File outFile = fileOutput.getSelectedFile(); 
                String fileOutName =  outFile.getAbsolutePath();

                txtFileOut.setText(fileOutName);
                        }
                    }
                    if(a.getSource() == btnProcess)
                    {
                    PrintWriter fout = null;
                    try 
                    {
    Scanner lineScanner = new Scanner(new FileInputStream(txtFileIn.getText()));
            fout = new PrintWriter(txtFileOut.getText());
            while(lineScanner.hasNext())
                        {
            String line = lineScanner.nextLine();
                          Scanner rowScanner = new Scanner(line);
            int i=0;
            int parentAge = 0;
            int childsAge = 0;
            while(rowScanner.hasNext())
            {
                if(i==0)
                {
            fout.println("Whoes your daddy: " + rowScanner.next() + " ");
             parentAge = rowScanner.nextInt();
            }
            else
            {
                  fout.println(i +". " + rowScanner.next() + " ");
                  childsAge+= rowScanner.nextInt();
                }

                i++;
            }
            if(childsAge&gt;parentAge)
            {
                fout.println("You are older than dirt");
            }
            else
            {
                fout.println("Just a kid still ...");
            }

             fout.println("\n");
        }
    } 
    catch (FileNotFoundException e) 
    {
       System.out.println(e.getMessage());
    }
    finally
    {
        if(fout != null)
    {
        fout.close();
     }

         }
}
  }
private JPanel PanelWrap(Component c)
{
    JPanel panel = new JPanel();
    panel.setBackground(Color.DARK_GRAY);
    panel.add(c);
    return panel;
}
 }
</code></pre>
