Java – jtextfield listener when modifying textfield text
•
Java
I know how to add a text listener on jtextfield, trigger when the text changes, and modify the text of jtextfield during operation
It seems appropriate that I try to use addinputmethodlistener, but it doesn't seem to work I also tried textfield getDocument(). Adddocumentlistener(), but this throws a Java Lang. IllegalStateException: when I try to modify the text of textfield, I try to mutate in the notification
Solution
Documentlisteners cannot modify the underlying document of JTextComponent You are looking for documentfilter
Example
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码