views:

28

answers:

2

Okay, I want to override JTextArea's Document's remove method, I can't figure out what class to extend. I can't extend Document cause it's a interface, and that also means it must not be the document that JTextArea creates. So how exactly can I easily override my JTextArea's document's remove method?

+2  A: 

The default Document of a JTextArea is PlainDocument, as mentioned in createDefaultModel(). Here is a simple example of overriding insertString() in PlainDocument.

trashgod
A: 

Try to use DocumentFilter instead.

StanislavL