parsing primitive types using java.util.Scanner
<p>I'm new to java so forgive the noob question.</p>

<p>I have created a swing application that basically has three input strings in JTextFields:
loanAmount, interestRate and loanYears and a single submit button with the EventAction.</p>

<p>I'm trying to use the java.util.Scanner to parse the input to primitive types that I can use in calculations.</p>

<p>I'm getting an error in NetBeans indicating that my variables are not recognized?
should I not be calling System.in?</p>

<pre><code>private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {
    Scanner keyInput = new Scanner(System.in);
    while (true)
        try{
            double amount = keyInput.nextDouble(loanAmount.getText());
            double interest = keyInput.nextDouble(interestRate.getText());
            int years = keyInput.nextInt(loanYears.getText());

        } catch (NumberFormatException nfe){

        }
}
</code></pre>
