swing: appropriate Listener for JTextField change events

六月ゝ 毕业季﹏ 提交于 2019-12-09 15:53:59

问题


Which type of Listener do I use for listening to changed text events in a JTextField? (I should know this or be able to tell from the Javadoc but I can't seem to figure it out.)


回答1:


Use the underlying document:

myTextField.getDocument().addDocumentListener();


来源:https://stackoverflow.com/questions/2165071/swing-appropriate-listener-for-jtextfield-change-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!