Java 何时在文档筛选器中使用insertString方法?
我一直在玩文档过滤器,但有一件事我不明白,什么时候使用Java 何时在文档筛选器中使用insertString方法?,java,swing,documentfilter,Java,Swing,Documentfilter,我一直在玩文档过滤器,但有一件事我不明白,什么时候使用insertString方法?我只见过它在我能想到的几乎所有可能的场景(复制/粘贴、手动键入等)中使用replace或remove方法。从文档中可以看出: Invoked prior to insertion of text into the specified Document. 但我尝试的每一种文本插入方法都执行了replacemethod 有人能帮我简化一下这个方法的具体使用时间吗?当调用Document\insertString时会
insertString
方法?我只见过它在我能想到的几乎所有可能的场景(复制/粘贴、手动键入等)中使用replace
或remove
方法。从文档中可以看出:
Invoked prior to insertion of text into the specified Document.
但我尝试的每一种文本插入方法都执行了replace
method
有人能帮我简化一下这个方法的具体使用时间吗?当调用
Document\insertString
时会调用它。你的意思是当使用textField.getDocument().insertString…
时?(只是确认一下)这是打电话的一种方式it@user3271166,查询: