在Java中使用Frame或JFrame时? [英] When you use Frame or JFrame in Java?

查看:164
本文介绍了在Java中使用Frame或JFrame时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
swing和awt有什么区别?

Possible Duplicate:
What is the difference between swing and awt?

我经常看到JFrame被大量使用. 但是有时候,我也看到程序员在他们的示例中使用了Frame. 那你能告诉我它们的优缺点吗?

I often see that JFrame is used a lots. But sometimes, I also see that programmer use Frame in their example. So could you tell me the advantages/disadvantages of them?

推荐答案

好,让我为您分解……........在进入Frame vs JFrame之前,让我解释一下关于AWT和Swing.

Well let me break it up for you.............. Before jumping into Frame Vs JFrame, let me explain you about AWT and Swing.

AWT:

-.它具有依赖于平台 Look and Feel.

-,因此它使用了本地GUI 组件.

- So it uses the Native GUI components.

-.由于AWT使用对等组件,因此称为 Heavy Weight Component .

- As AWT uses the peer components, its called as Heavy Weight Component.

摇摆:

-.它具有与平台无关 Look and Feel.

-及其原因,因为它使用了纯Java 组件.

- And its because it uses the Pure Java Components.

-由于Swing使用纯Java组件,因此称为轻量级组件.

- As Swing uses pure java components, its know as Light Weight Component.

据说AWT使用平台组件要比Swing快,但是由于更快的处理器等的出现……现在它等效了,您将获得很大的灵活性.

Its was said that AWT is faster than Swing as it uses the Platform component, but due the arrival of faster processor, etc .... Its equivalent now..and you get lots of flexibility.

这是GUI树:

        Object
           |
        Component
           |
        Container
  ---------|---------

  |                 |
JComponent        Window
  |                 |
JPanel            Frame
                    |
                  JFrame

现在 Frame AWT component,其中 JFrame Swing component.

您还可以看到JFrame扩展了Frame.

You can also that see JFrame extends Frame.

但是JFrame与Frame相比提供了很多功能和灵活性,我们甚至可以说Swing提供了更好的功能,并且易于实现.

But JFrame, provides lots of functinality and flexibility as compared to Frame, we can even say this that Swing provides better functionality with ease of implementing them.

这篇关于在Java中使用Frame或JFrame时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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