Reputation: 109
I am using a JTextPane
in my project, where i add some tags through code like [PKG MEDIA] etc.
I want to restrict user to copy and paste them in JTextPane
.
Upvotes: 1
Views: 551
Reputation: 57381
You should override Writer
used in your EditorKit
to skip some Element's
content.
To prevent paste you can add a DocumentFilter
in simplest case but in some cases paste directly changes Document's
structure so you should override Reader
which creates the structures.
Upvotes: 2