Simple Java Validation
<p>I am a web app programmer (mostly PHP/JavaScript/Ajax etc).
There is this payroll appplication that I want to code in java. I needed to know where I could find tutorials on how to do basic validation in java e.g. checking if a textfield is null, making sure only integers are allowed etc. </p>

<p>I have this basic program that runs and created a jFrame form:</p>

<pre><code>private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

        double num1, num2, result;

        num1 = Double.parseDouble(jTextField1.getText());

        num2 = Double.parseDouble(jTextField2.getText());

        result = num1 + num2;

        jLabel4.setText(String.valueOf(result));
    }
</code></pre>

<p>How can I for instance get to validate that jTextField's 1 and 2 are not left blank. i.e., to return an error box that lets a user know that both fields cannot be left blank?</p>

<p>I was trying this as a tester:</p>

<pre><code> if(num1 == 0 &amp;&amp; num2 == 0)
        {
            JOptionPane.showMessageDialog(null, "You must fill in all fields");
        }
</code></pre>

<p>But this doesnt work at all</p>
