我为 JEditorPane 实现了 DocumentListener(需要方法 insertUpdate(DocumentEvent e) 的帮助)。如何读取最后一个单词或最后一行(行由 '\n' 分隔,单词由 ' ' 分隔)?
最佳答案
实用程序类可与格式化内容一起使用,例如html
public static final int getWordStart(JTextComponent c, int offs) throws BadLocationException
public static final int getWordEnd(JTextComponent c, int offs) throws BadLocationException
关于java - 如何读取DocumenListener中的最后一个单词或最后一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5646681/