What is the difference between awt and swing
The major components of AWT are buttons, radio buttons, checkboxes, choice buttons, labels, and text fields. On the other hand, Swing has lightweight components, which have wider functionality and execute within a short period. Swing of Java actively supports MVC patterns.
AWT was launched and developed by Sun Microsystems in It is generated by the system host of the operating system. It is heavy and it contains a huge number of classes, functions, and methods that are efficient in the management and creation of GUI. The components of AWT are heavy and require considerably large memory space. The execution time and speed of AWT are slow to medium-paced.
AWT of Java has a moderate quality of components. AWT requires a native operating system to implement all the functionalities. Another statement which i saw is that swing is MVC based and awt is not.
Swing vs AWT. Basically AWT came first and is a set of heavyweight UI components meaning they are wrappers for operating system objects whereas Swing built on top of AWT with a richer set of lightweight components. Swing also has very much richer functionality. Using AWT, you have to implement a lot of things yourself, while Swing has them built in. Because Swing implements GUI functionality itself rather than relying on the host OS, it can offer a richer environment on all platforms Java runs on.
AWT is more limited in supplying the same functionality on all platforms because not all platforms implement the same-looking controls in the same ways. Swing components are called "lightweight" because they do not require a native OS object to implement their functionality.
JDialog and JFrame are heavyweight, because they do have a peer. A peer is a widget provided by the operating system, such as a button object or an entry field object. AWT 1. AWT occupies more memory space 2.
AWT is platform dependent 3. AWT require javax. Swing occupies less memory space 2. Swing component is platform independent 3. Swing requires javax. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. What is the difference between Swing and AWT?
Ask Question. Asked 12 years, 10 months ago. Java swing components offer support to the pluggable feel and look. Number of components AWT components are less in number in comparison to Swing components.
Java Swing components are compelling and much more in number. They are represented by lists, scroll panes, tables, tabbed panes, color choosers, etc. Package required AWT components need the java. Swing components in Java need the javax.
Advanced features The advanced features depicted by Swing components are not present in AWT components. Swing components depict several advanced features such as Jtabel, Jtabbed pane, etc. These advanced features are specific only to Swing components. There exists one peer for each control, and there is one peer for the dialogue itself. Peers are in the form of widgets offered by the operating system.
They may be a button object or a specific entry field object. The entry fields, buttons, etc. Swing possesses more codes because of this very reason. A "peer" is a widget provided by the operating system, such as a button object or an entry field object. With Swing, you would have only one peer , the operating system's window object.
All of the buttons, entry fields, etc. This is the reason that Swing has more code. It has to draw the button or other control and implement its behavior instead of relying on the host operating system to perform those functions. Is it helpful? Yes No. JSP vs Servlets. JSF 1. JSF 2. Java 5 vs Java 6. Java 6 vs Java 6 update Java 6 vs Java 7. Java 6 update 10 vs Java 6 update Java 1. Struts 1 vs Struts 2. Struts 1. Linux vs Unix. Java vs J2EE. Java vs Kotlin.
Struts vs JSF. Struts vs Spring. Spring vs Spring Boot.
0コメント