INTRODUCTION | AWT, SWING, JavaFX
AWT, SWING, JavaFX are APIs. All of them used to develop GUI (Graphical User Interface).
what is GUI? GUI is an interface that interacts with user and source code. It makes the software user friendly. So, Users interact with the interface and that interface interacts with source code.
Example of GUI- Calculator, All buttons are shown on-screen are components of GUI.
Also, The user is not interacting directly with code.
Let’s discuss AWT, SWING, and JavaFX –
AWT
also, Its full form is Abstract Window Toolkit. Released in 1995 with java. It’s an API used to develop GUI for Windows-based applications in the Java programming language.
AWT is Platform dependent i.e, its components display according to the Architecture of the operating system. also, To use its components import java.awt.package. However, This package provides classes for it API like textField, label, text area, etc.
so, AWT components are heavyweight which means components use resources of the operating system. So, Programmers have control over it as the looks of components vary on different platforms.
Hence, It doesn’t follow MVC ( Model View Architecture Model ) where Model means data, View Architecture means presentation and Controller means Interface between model and view.
Hierarchy of AWT
SWING
It’s an API used to develop GUI for desktop-based applications in the Java programming language. It was released in 1997 built on AWT.
So, its components display does not depend on the architecture of the operating system. To use SWING components import javaX, swing package. So, This package provides classes for SWING API like textField, label, text area, etc.
However, SWING components are lightweight which means components do not use many resources of the operating system.
so, It follows MVC ( Model View Architecture Model ) where Model means data, View Architecture means presentation and Controller means Interface between model and view.
SWING built on top of AWT API. However, it is also an extended version of itself. SWING has more components than it like the Radio button.
Hierarchy of SWING
JavaFX
Also, To work with JavaFX no prerequisite knowledge of any other technology required. However, The package needed to import JavaFX.util has a graphical processing unit.
It provides graphics pipelines which accelerate graphical processing without external storage JavaFX also provides canvas and printing APIs, support drag and drop facility, etc.
Hence, Styling provided by JavaFX is like CSS. the number of components in JavaFX is more than AWT but less than SWING.
Tabular difference
CHARACTERISTIC | AWT | SWING | JavaFX |
DEPENDENCY | Platform dependent | Platform independent | Platform independent |
WEIGHT OF COMPONENT | Heavyweight | Lightweight | Lightweight |
CURRENTLY IN USE | Discarded | Use it in a few places. | Currently in use |
PLUGGABLE | Does Not support a pluggable look and feel | support pluggable look and feel. Components look the same on all systems | support pluggable look and feel. Components look the same on all systems. |
MVC | Does Not Follow MVC | Follow MVC | Follow MVC. |
NO. OF COMPONENTS | less | More than AWT | More than AWT but less than SWING. |
PACKAGE | java.awt.package | javax.swing | javafx.util |
RELEASED | 1995 | 1997 | 2008 |
CONCLUSION:
Hence, it is not in use currently. Also, SWING is in use at some places. JavaFX is also in use.
SWING has more components than JavaFX but JavaFX GUI is more modern and rich than SWING’s GUI. It will discard totally in the next few years So, it’s better to learn JavaFX.
Written by: Yatika Yadav
Reviewed By: Soutik Maity
If you are Interested In Machine Learning You Can Check Machine Learning Internship Program
Also Check Other Technical And Non Technical Internship Programs