Table of Contents

Use HTML Content

Many components support automatic HTML rendering - if you need to format only part of a label, or button caption, use HTML. This also helps to limit the width of text (and activate word-wrap) in tool tips, and create multi-line content (use <br> element to break lines).

In stead of entering plain text, start the content string of a JLabel or JButton with


However, try to use as much CSS as you can, since CSS support is good, but HTML support is limited to 3.2.

HTML rendering does induce a significant performance overhead, so do not use it on objects that get rendered often (such as contents of a large table).

See also

External Links


Comments? Corrections? Contact us or Login to edit pages directly (registration is free and takes less than displaying a JLabel)
  best/use_html_content.txt · Last modified: 2005/03/15 16:25 by (gojko)
Recent changes | RSS changes | Table of contents | News Archive | Terms And Conditions | Register