Let ActionListener listen for change in JTextField instead of only enter?

后端 未结 3 2123
栀梦
栀梦 2020-12-04 01:27

So as you may know, if you have a text field and you add an ActionListener to it, it will only listen to the keypress of the enter button. However, I want to let my ActionLi

3条回答
  •  余生分开走
    2020-12-04 02:07

    From an answer by @JRL


    Use the underlying document:

    myTextField.getDocument().addDocumentListener();
    

提交回复
热议问题