在Java中,JFrame的是重量级组件或重量轻的组成部分? [英] In java, JFrame is Heavy Weight Component or Light Weight Component?

查看:358
本文介绍了在Java中,JFrame的是重量级组件或重量轻的组成部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道秋千被认为是轻量级的,因为它是用Java完全实现,而不调用本地操作系统绘制的图形用户界面组件。

I Know Swing is considered lightweight because it is fully implemented in Java, without calling the native operating system for drawing the graphical user interface components.

在另一方面,AWT(抽象窗口工具包)是重量级的工具包,因为它仅将调用操作系统,以便产生其GUI组件。

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.

但我听说,摆仍是基于AWT,甚至Swing组件必须至少有一个重量级的容器。换句话说,的JFrame,JApplet的不lightweight.Is是真的吗?
现货的原因是什么?

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都是重量级的,因为这是不可能的,而无需创建一个沉重AWT窗口创建在大多数操作系统任务视图级别的窗口。轻型组件可以替换基于Java的东西,内部部件不需要JNI调用,但窗户是特殊情况。 JFrame中没有让你做定制渲染,虽然。此外,如果您使用的其他轻量级的东西,那么我建议您使用的JFrame以及因为它使渲染比混合轻质和重质成分更有效的整体。

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.

这篇关于在Java中,JFrame的是重量级组件或重量轻的组成部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆