开发者

In java, JFrame is Heavy Weight Component or Light Weight Component?

开发者 https://www.devze.com 2023-04-04 05:26 出处:网络
I Know Swing开发者_如何学C is considered lightweight because it is fully implemented in Java, without calling the native operating system for drawing the graphical user interface components.

I Know Swing开发者_如何学C is considered lightweight because it is fully implemented in Java, without calling the native operating system for drawing the graphical user interface components.

On the other hand, AWT (Abstract Window Toolkit) is heavyweight toolkit, as it merely makes calls to the operating system in order to produce its GUI components.

But i heard that Swing is still based on AWT, and even Swing components must have at least one heavyweight container. In other words, JFrame, JApplet are not lightweight.Is it true? Spot your reason?


JFrames are heavyweight, since it's impossible to create a task-view-level window in most OS without creating a "heavy" AWT window. Lightweight components can replace internal widgets with java-based stuff that doesn't require JNI calls, but windows are the special case. JFrame does let you do custom renders, though. Also, if you're using other lightweight stuff, then I suggest using JFrame as well since it makes the rendering more efficient overall than mixing light and heavy components.

0

精彩评论

暂无评论...
验证码 换一张
取 消