Difference Between AWT and Swing
Programming in the Java language has really begun to take off simply because of their capability to bring programs across multiple platforms. This is not only true for desktop computers but Java is also present in pocket PC’s and even in the standard mobile phones. Because of this, there are already a lot of people who wish to program for the Java language to take advantage of this big and growing market.
Programming in Java means that you must have the right tools in order to quickly and efficiently finish your project. One of the essential tools is the GUI (Graphic User Interface) component. This allows you to easily add graphical component without the bulk of the programming required. In this category, there are two that you can choose from. The first is the AWT (Abstract Window Toolkit) and the second is the swing, which appeared much later.
Both of these toolkits have their own pros and cons that make them suitable for different kinds of programming needs. The AWT uses a lot of the native commands of the platform that lends it a great amount of speed. But in order to convert it for use in other platforms, you must change the counterpart commands. Swing on the other hand uses pure Java code making it very portable across platforms at the cost of speed and performance.
Another feature of swing is that it tries to emulate the look and feel of the OS that it is running on, making it resemble the native environment. This is beaten by AWT since it uses native commands; it looks exactly what the native UI looks like. A major advantage of swing is that it supports a lot more features than what AWT does. Components like tooltips and icons are not available in AWT while being fully usable in swing. The added features and the pure java design of swing though means that you would require the java plug-in in order for the program to run, while most of the browsers today already support the AWT classes that eliminates the need for plug-in downloads.
To summarize, if you would like to create simple java applets then you might find the fast and easy construction methods of AWT to be of great help. But if you want to create a full blown application, you might look into what swing could offer you. The enhanced component list and portability might prove to be more useful.
Search DifferenceBetween.net :
Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.