How to enable a button when text is entered in a text field in Netbeans
<p>I'm very new at coding Java and Netbeans. So basically, I have a "save" button and three text fields, I want to enable the Button when these three text fields are edited and disable the button when one of them is empty. Also I'm wondering where I should put my codes. Since it's Netbeans I'm only familiar with ActionPerformed methods, there you can set an action when a button is pressed. </p>

<p>If you can keep it simple it would be appreciated!</p>

<p>public project() {</p>

<pre><code>    initComponents();
    //Here I want the window to appear in the middle of the screen
    setLocationRelativeTo(null);

    if(txfField1.getText().equals("")){
        btnSave.setEnabled(false); 
    }
    else {
        btnSave.setEnabled(true);
    }


}
</code></pre>

<p>I tried with this code on only one of the three text fields and It does not work, the button is always enabled. The button is initially disabled. Additionally I have also tried to put my code below this method:</p>

<p>public class project extends javax.swing.JFrame {</p>