Java Swing组件中的HTML标签 [英] HTML Tag in Java Swing Components
问题描述
向Swing组件(例如JLabels)添加HTML标签是否会使JFrame的渲染变慢?我的意思是Swing组件中HTML呈现的性能如何?
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?
推荐答案
是的,具体取决于您的html的复杂程度.
Yes, depending on the complexity of your html.
实际上,当jlabel中包含html时,BasicLabelUI使用
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.
为清楚起见,您可以阅读BasicLabelUI.paint()的代码.
You can read the code of BasicLabelUI.paint() for clarity.
但是对于装饰简单的html,我根本不需要担心.
But for simple decorated html, I don't think you need to worry at all.
这篇关于Java Swing组件中的HTML标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!