• Post Reply Bookmark Topic Watch Topic
  • New Topic

Customizing JEditorPane  RSS feed

 
Pankaj Tiwari
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
Has anyone worked with JEditorPane. Actually i wanted to create a custom tag and make JEditorPane to understand that tag. Can anyone help me as to what all things are to be done to create custom tag that JEditorPane understands.

Thanks in advance
 
Brian Cole
Author
Ranch Hand
Posts: 947
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find HTMLEditorKit (which is how JEditorPane deals with HTML) unwieldy. For one, it hasn't been updated as HTML has evolved, so there are some things one would expect it to handle on which it fails. (XHTML-style self-closing tags come to mind.)

That said, O'Reilly's Java Swing, 2nd Edition book has some ancillary materials that cover HTMLEditorKit. In particular, the example near the end of HtmlEdKit.pdf has some code that recognizes a custom <ora>...</ora> tag. It doesn't do much with it, but it might be worth a look.

disclaimer: I am one of the authors of Java Swing, 2nd Edition but I did not author the ancillary materials.
[ January 12, 2007: Message edited by: Brian Cole ]
 
Pankaj Tiwari
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brian
I had visited that link earlier also, but i am not able to figure out where i am getting wrong .The requirement is that i have a button on click of which <media></media> tag should be generated in backgound and some UI should be displayed in JEditorPane for eg: A Button. I am totally confused with all this. I have writtern the following code on click of button


here htmlkit is custom EditorKit that i have created. The code is attached below


my custom made XeHTML file has this code



Please help since i am totally confused as to how to proceed ahead. I think i am making some mistake in registering the tag.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!