Key Difference – AWT vsSwing
Java是一个high-level programming languagedeveloped by Sun Microsystems.JavasupportsObject Oriented Programming这有助于使用对象设计和开发软件。汇编Java程序后,将其转换为字节码。该字节码在任何平台上都由Java Virtual Machine(JVM)解释。因此,它是一种编程语言,程序员可以编写一次并在任何平台上运行。Java可用于开发各种应用程序,例如桌面,移动和Web应用程序。该语言提供了创造丰富的工具包图形用户界面(GUI). Two of them are AWT and Swing. This article discusses the difference between AWT and Swing. Thekey differencebetween AWT and Swing is thatawtis Java’s original platform dependent windowing, graphics, and user interface widget toolkit while Swing is a GUI widget toolkit for Java that is an extension for AWT.
内容
1.Overview and Key Difference
2.What is AWT
3.What is Swing
4.AWT和秋千之间的相似之处
5.Side by Side Comparison – AWT vs Swing in Tabular Form
6。概括
什么是AWT?
A Graphical User Interface is an interface for users to provide instructions for the software to perform tasks. It consists of various graphical components. Some GUI components are window, button, combo box, text area, list box, and label. Using these components, the programmer can develop an interactive user interface for the application. A GUI is based on events. Button click, closing the window, typing something in the textbox are some examples of events that can occur in a Graphical User Interface based application. Today many applications contain GUIs. Mobile applications, Air ticket reservation systems, Automated Teller Machines have rich graphical interfaces for customers to use the application easily.
AWT代表Abstract Window Toolkit. AWT requires a native OS object to implement the functionalities. Therefore, AWT components are heavyweight and require more memory space. AWT components also take time to execute. The number of components available in AWT is minimum. It is necessary to import javax.awt package to develop an AWT based GUI applications.
一些AWT组件是按钮,文本字段,下拉框,滚动条,窗口,框架,面板,标签。创建对象后,可以将它们放入容器中。一个容器为组件加载的空间提供了空间。AWT不支持可拉的外观和感觉。因此,在一个操作系统中开发的AWT应用程序可能在另一个操作系统中看起来不一样操作系统.
What is Swing?
Swing is a GUI widget toolkit for Java. It is a part of Oracle’s Java Foundation Classes (JFC). It is an Application Programming Interface to build GUI for Java applications. It is built on top of AWT API. Swing was developed to provide more flexible and sophisticated components than AWT. Swing contains basic components such as labels, text boxes, buttons. It also contains more advanced components. Some of them are trees, tables, lists, scroll panes and tabbed panes. If the programmer needs to implement a Swing application, it is necessary to import javax.swing package. The package provides classes for Java Swing API such as JButton, JRadioButton, JTextField, JCheckbox etc.
摆动组件没有特定于平台的代码。因此,秋千是独立的平台。与AWT不同,Swing不需要本机操作系统来构建组件。JVM负责调用本机方法。秋千组件很轻。所需的内存空间也最小。这是更快地运行基于挥杆的应用程序的相当大的因素。在应用程序开发中,模型,视图,控制器(MVC)是一种常见的设计模式。该模型代表数据。该视图代表演示文稿,而控制器是模型和视图之间的接口。 Swing follows this pattern. Swing supports the pluggable look and feel. Overall, it is more powerful than AWT.
What is the Similarity Between AWT and Swing?
- Both are Java-based toolkits to build Graphical User Interface.
What is the Difference Between AWT and Swing?
AWT与秋千 |
|
AWT是Java的原始平台依赖窗口,图形和用户界面窗口小部件在秋千前。 | Swing is a GUI widget toolkit for Java which is a part of Oracle’s Java Foundation Class (JFC). |
平台依赖性 | |
awtcomponents are platform dependent. | Swing components are platform independent. |
数量的组件 | |
awtcontains less number of components. | Swing has a higher number of components. |
Components | |
AWT组件是重量级的。 | 秋千组件是轻量级的。 |
MVC | |
awtdoes not follow MVC. | 秋千跟随MVC。 |
速度 | |
AWT不像秋千一样快。 | Swing is faster than AWT. |
所需的内存空间 | |
awtcomponents require more memory space. | Swing components require less memory space. |
Required Package | |
awtrequires importing javax.awt package. | Swing requires importing javax.swing package. |
Pluggable Look and Feel | |
AWT不支持可拉的外观和感觉。 | Swing provides a pluggable look and feel. |
概括–awt vsSwing
本文讨论了两个AW和Swing的图形用户界面设计工具。AWT和Swing之间的区别在于AWT是Java的原始平台依赖窗口,图形和用户界面小部件工具包,而Swing是Java的GUI小部件工具包,这是AWT的扩展名。秋千提供了与AWT相比的更丰富的功能。使用秋千建造的GUI的外观看起来比AWT的GUI更好。与AWT不同,Swing支持可凹陷的外观和感觉,并提高应用程序的可用性。
Download the PDF Version of AWT vs Swing
You can download the PDF version of this article and use it for offline purposes as per citation note. Please download the PDF version here:迪fference Between AWT and Swing
Reference:
1.tutorialspoint.com. “SWING Overview.”The Point.Available here
2.“Swing (Java).” Wikipedia, Wikimedia Foundation, 24 Jan. 2018.Available here
3.“Abstract Window Toolkit.” Wikipedia, Wikimedia Foundation, 22 Jan. 2018.Available here
4.“Java Swing Tutorial – javatpoint.”Available here
5.tutorialspoint.com. “AWT Overview.”The Point.Available here
Image Courtesy:
1.’AWTSwingClassHierarchy’ By Jakub Závěrka – Jakub Závěrka – own work, (Public Domain) viaCommons Wikimedia
发表评论