Text Changed event in JTextArea? How to?

前端 未结 3 707
眼角桃花
眼角桃花 2020-12-03 17:05

I have been trying to make a text changed event handling mechanism for my JTextArea. For my purposes an event has to be fired whenever there is a change in the

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 17:44

    I would get the JTextArea's Document via getDocument() (a PlainDocument actually) and use a DocumentListener to listen for changes. This way you'd capture changes from key strokes and also from copy/paste/cut events.

提交回复
热议问题