I have 4 jTextFields that I save the input to a file once a submit button is pressed. I want to be able to keep the submit button disabled until each field is at least not n
You need to add listeners to detect when the user enters text. In order to have it register any change (and not just when the user hits Enter
) you should attach a DocumentListener
to the underlying document of each JTextField
.
Then, have each listener call a function to do your check and update the JButton
's enabled
status accordingly.
Related