标签: java swing documentfilter
我一直在玩文档过滤器,但有一点我无法理解的是,究竟是什么时候使用了insertString方法?我只看到它在我能想到的几乎所有可能的场景中都使用replace或remove方法(复制/粘贴,手动输入等)。从文档来看,它说:
insertString
replace
remove
Invoked prior to insertion of text into the specified Document.
但是我尝试文本插入的每个方法都执行了replace方法。
如果使用此方法,有人可以为我简化吗?