Wednesday, April 6, 2011

Which HTML tags are supported in Swing components?

Many Swing components support embedded HTML, but I cannot find any official documentation on that subject. (Everything on Sun's pages about HTML seems to be targeted at JEditorPane)

So: Which HTML tags are supported in Swing components?

EDIT: Although I said that I'm missing "official documentation", I'd also like any "unofficial" documentation.

From stackoverflow
  • I don't know exactly what tags are supported, but I would suggest that you restrict yourself to bold/italics (or even better strong/em assuming it supports them) and img tags. Anything else is likely to cause headaches, and probably means you're stuffing too much into that component.

    Software Monkey : This is really a non-answer.
    Draemon : I don't think so - I'm saying that although it probably "supports" more - it's unlikely to support it well, and I've made a suggestion as to what the real issue might be.
    instanceofTom : I think this is a valid answer, I found this question through searching because I had the same question, and I think Draemon brings up a good point- "Anything else... probably means you're stuffing too much into that component."
  • I believe it's a narrow subset of HTML 3.x, although off the top of my head, I don't remember where I read that.

    Software Monkey : The Swing text component supports HTML 3.2 (Wilbur) and a reasonable subset of CSS 1.0.
  • As with most things with Swing, the best course of action is to look at the source.

  • This guy feels your pain and is at least starting to collect his experiences:

    http://retrovirus.com/brunch/2003/04/html-support-in-jeditorpane/

0 comments:

Post a Comment