• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTMLEditorKIT

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my application there is textarea in which users are allowed to paste their html content(possibly mail contents from outlook they have paste it).
For that i used below code



While running,when i copied contents from outlook and pasting into application, extra brackets along with text wording 'fragments' are coming in start and end of the copying contents.

Any suggestions why this is coming so?.Thanks in advance.
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vidya sagar:
In my application there is textarea in which users are allowed to paste their html content(possibly mail contents from outlook they have paste it).
For that i used below code



While running,when i copied contents from outlook and pasting into application, extra brackets along with text wording 'fragments' are coming in start and end of the copying contents.

Any suggestions why this is coming so?



If you want to use HTMLEditorKit you should probably be using
a JEditorPane instead of a JTextPane. (JTextPane is a subclass
of JEditorPane, but is designed to be used with StyledEditorKit.)

Probably the easiest way to do this is:

JEditorPane subjectPanel = new JEditorPane("text/html", "");

Replace "" with some HTML markup if you wish. Simple, eh?

[edit: Even though what I wrote is correct, I now realize that
I probably misjudged your problem. Swing's HTML support is fairly
primitive, and I would guess that you're just running into the
usual limitations. One example is that it doesn't handle XHTML-
style self-closing tags such as <br/> correctly--it inserts
visible artifacts as you describe.
There's no good solution to this within Swing. Many of us have
been waiting for better HTML support in Swing but it's been a
while and there's no indication it's coming. Your two main choices
are to simplify the HTML you expect it to display or to look
for a Component (or possibly just an EditorKit) from a 3rd party.]
[ October 16, 2008: Message edited by: Brian Cole ]
 
vidya sagar
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Brian.You got my point.i was facing HTML limitations in Swing.Am gonna try some 3rd party editors.If you know/suggest any 3rd part editors, please let me know.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic