Saturday, 15 April 2017

Difference between Swing and AWT

  • Although awt is the curcial part of java, it's comoponent sets are not widely used to create GUI components nowadays.
  • Swing provides more powerfull and flexible GUI components than awt, hence today many programmers are using swing or javafx for building GUI based application.

  • The AWT also provides controls, dialog boxes, windows, containers which are useful, but with a limited graphical interface.

  • One reason for limited nature of AWT comnponents is that it translates it's various components into their corresponding, plat-form specific eqiuivalent or peers.

  • This means that the look and feel of an awt component is decided from it's native platform and not by java.

  • Because of these reasons AWT Components  are called heavy weight components.
NOTE :- AWT components are not fully created in java, this  is the reason they are called heavy-weight components. Whereas Swing components are fully created in java hence they are light-weight components.


  • Swing eliminates all the problem associated with awt by providing extra components like JTabbedPane, JTree etc.
  • Swing does not overcome awt, but it is build using the funtions of awt

✭ Key features of Swing

  1. Swing components are light-weight
    • Since the swing components are fully created in java, they do not convert their visual components into their corresponding/native platform peers. Means the look and feel is decided by java.
    • Thus, light -weight components are more flexible and more efficient.
      2. Swing supports plugable look and feel
    • As we discussed before that  the swing components are created in java and not by other programming languages, the look and feel is under the control of swing.
    • This, means that to seperate the look and feel from component logic and this what swing does.
    • Also swing can create a better look and feel on any platform, than awt because it contains pluggable(Means it can be attached easily) look and feel feature. 

0 comments:

Post a Comment