Does adding HTML tags to Swing components, for example JLabels, make rendering of JFrame slow? I mean how is the performance of HTML rendering in Swing components?
2 Answers
Yes, depending on the complexity of your html.
Actually when you have html in your jlabel, the BasicLabelUI uses a View to paint the label instead of simple paint logic. Now you can check various different implementations of View class to check how it affects you.
You can read the code of BasicLabelUI.paint() for clarity.
But for simple decorated html, I don't think you need to worry at all.
Comments
Swing's HTML rendering support uses many classes, therefore users on older systems might notice a delay the first time a component with HTML formatting is shown. One way to avoid this delay is not to show the HTML-formatted component immediately and to create it (or another component that uses HTML) on a background thread.