addKeyListener « JTextField « Java Swing Q&A





1. JtextField addKeyListener    coderanch.com

Hi, I have a text field and a button. I want to disable the button when the text field is empty. So I thought that the best thing to do was to check after every key pressed: when a character was entered I should enable the button, and when the text field is cleared I should disable it. But when I ...