Simple applications, to which this Java calculator belongs, can nowadays be programmed relatively comfortably and quickly. The corresponding API’s (Application Programming Interface) provide every programmer with all necessary functions to draw windows and dialog boxes on the screen. The API contains definitions for the interaction between the individual software components. An abstraction between a high-level and a low-level programming language is tried to be achieved with the help of these low-level processes, as the creation of a matrix for the representation of text can be realized quickly.
In Java there are three main API’s for creating graphical user interfaces. The AWT (Abstract Window Toolkit), Swing and finally the SWT (Standard Widget Toolkit). Sun’s AWT class libraries provided the first frameworks and GUI routines for Java programmers. AWT was also the first development system for user interfaces in the Java Foundation Classes (JFC). However, some conceptual errors in the design of AWT quickly became apparent. The low abstraction via the native user interface below led to display problems on different operating systems. While e.g. on Windows the program looked and worked as expected, on Linux it could be completely different and vice versa. In the 90’s some programmers made fun of it by saying that Sun’s motto was “write once, test everywhere”. But this contradicted the philosophy of platform independence of Java.
Between 1997 and 98 Sun Swing introduced, which was completely written in Java and revealed more possibilities. In the second JDK version, most of the AWT widgets were replaced by those from the Swing Toolkit. Swing avoids the problems of AWT by drawing its own widgets. This means that Swing components are rendered directly by Java and are not dependent on native operating system components. This means that all Swing components work on all platforms, regardless of whether the platform provides a corresponding component or not.
In the meantime, there are many other reasons for using Swing over AWT. This includes the performance, completeness of the class libraries and the development of the libraries.
The problem of visual representation of Java programs using Swing, which results in Java programs not looking like native programs, led IBM to develop 2001 for the development environment Eclipse SWT. We tried to avoid the problems of AWT by trying to integrate native widgets through the thinnest possible wrappers. The standard widget toolkit framework uses JNI to access the native components. If a component is not available on the platform, SWT emulates that component. Meanwhile there are different opinions to the two API’s. Which concept is better in the end is just as hard to answer as the question about the best operating system.
Concepts of Swing
An important aspect of modern software development is the so-called Model-View-Controller scheme, an important architectural pattern which divides the essential task areas into separate and interacting components. Namely the model itself, the view and the controller. While the controller takes care of the interaction with the user, the model provides data and informs the view of any changes in the installation, for example. The view takes care of the display of the data.