Java AWT

Tiranya Nirmani
2 min readDec 1, 2022

Java has been around for almost a quarter century. From the beginning, Java had the Abstract Window Toolkit (AWT), which provided a neat and easy way to create a cross-platform graphical user interface.

AWT was far from perfect. A Java program using AWT never looked exactly like a C++ program written for the specific operating system it was running on. An acceptable compromise for the ability to run on multiple operating systems, in my opinion.

Even allowing for that, AWT had several problems, some of which were quite obvious back then, and, as I’ll explain in a little bit, other problems which are more obvious to us today than they were years ago, due to our preference for encapsulation and immutability.

Soon after AWT, Sun Microsystems brought out Swing and later JavaFX. Even under Oracle, Java kept AWT, Swing and JavaFX (though JavaFX was moved to a separate module).

To keep this short, I’m not going to go over the whole AWT system. I’m going to focus on a single class, the Point class from the java.awt package.

The Point class has several problems, all of which might as well be written in stone, given that the terrible design decisions made a quarter of a century ago are relied upon by other classes in the JDK, and maybe also by third party libraries we might use.

--

--

Tiranya Nirmani

I'm an undergraduate at Java Institute for Advanced Technology. Currently, I am doing Bachelor's degree in Software Engineering at Birmingham City University