• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JEditorPane guarded blocks

 
ilkin esrefli
Greenhorn
Posts: 28
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all ranchers, please help me.

I am using shef swing html editor, it uses JEditorPane swing component. I want to add feature for guard from change(delete, update) some signed block of html like netbeans editor. Netbeans editor prevent some parts of code from changing.

For example we have html as


I want to prevent <p> block from update and delete, other parts can change.
I need your help.

Thanks!!!
 
Rob Spoor
Sheriff
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a DocumentFilter around the JEditorPane's Document. You'll need to do quite some checking and coding in there; insertString needs to check if the position is allowed, remove needs to remove everything except the blocked part, as does replace.
 
Rob Camick
Ranch Hand
Posts: 2613
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never tried it on a JEditorPane using HTML but you might be able to use the Protected Text Component.
 
ilkin esrefli
Greenhorn
Posts: 28
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your kind help. I solved the problem. Solution is placed here http://javam.wordpress.com/2010/07/22/jeditorpane-guarded-blocks
Regards!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic