Difference between AWT and Swing……….

Difference between AWT and Swing

  1. Swing is also called as JFC’s (Java Foundation classes) and AWT stands for Abstract windows toolkit.
  2. AWT components are called Heavyweight component and Swings are called light weight component because swing components sits on the top of AWT components and do the work.
  3. swings components are made in purely java and they are platform independent whereas AWT components are platform dependent.
  4. we can have different look and feel in Swing whereas this feature is not supported in AWT.
  5. Swing has many advanced features like JTabel, Jtabbed pane which is not available in AWT. Also. 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. So components like JButton, JTextArea, etc., are lightweight because they do not have an OS peer.
  6. With AWT, you have 21 “peers” (one for each control and one for the dialog itself). A “peer” is a widget provided by the operating system, such as a button object or an entry field object.
  7. With Swing, you would have only one peer, the operating system’s window object. All of the buttons, entry fields, etc. are drawn by the Swing package on the drawing surface provided by the window object. 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.
  8. Several consequences result from this difference between AWT and Swing. AWT is a thin layer of code on top of the OS, whereas Swing is much larger. Swing also has very much richer functionality.
  9. Using AWT, you have to implement a lot of things yourself, while Swing has them built in. For GUI-intensive work, AWT feels very primitive to work with compared to Swing. 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.



About Dinesh

I am engineering student........ I am selected in Microsoft Student Partner as MSP............

Posted on October 31, 2010, in Java. Bookmark the permalink. Leave a comment.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: