简体   繁体   English

如何在JEditorPane上实现文本更改

[英]How to implement in JEditorPane on text changed

如何在JEditorPane中实现文本更改方法(在添加或删除的每个字符上获取文本)?

You need to register a document listener with the document of the JEditorPane which will be notified when text is inserted or removed or when the text style changes. 您需要在JEditorPane的文档中注册一个文档侦听器,当插入或删除文本或更改文本样式时,该通知会得到通知。

Take a look at Java Tutorial > How to Write a Document Listener for more information about document listeners and document events. 查看Java教程>如何编写文档侦听器 ,以获取有关文档侦听器和文档事件的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM