Clarification on modifying a Document's contents from a DocumentListener

后端 未结 3 486

From the Swing tutorial on text components:

You may want to change the document\'s text within a document listener. However, you should never modify t

3条回答
  •  青春惊慌失措
    2020-12-21 22:52

    A direct answer is using SwingUtilities.invokeLater() placing the Document modification code there. But mKorbel's answer (+1) covers most of the cases you can imagine.

提交回复
热议问题