Introduction 2 - What is a GUI?
A GUI (pronounced GOO-ee), or Graphical User Interface, is the interface between the user and the code in the application underneath.
It is made up of various graphics that imply what the program is currently doing and presents actions available to the user. Usually the actions are performed by directly manipulating the graphical interface (e.g. pushing a button on the screen).
This is in comparison to a CLI, or Command Line Interface, where the user types commands on the keyboard to perform actions, and the output is written back to the terminal.
Often GUIs are an afterthought, especially when time and resource constraints are imposed on a project. The code, especially with Java, can be daunting and will put many people off. This site will hopefully let you learn quickly and easily how to put a professional-looking GUI together so that the work you do will really impress lecturers, employers and maybe even prospective investors!
There are two toolkits shipped with the default JDK, AWT and Swing.
The AWT, or Abstract Window Toolkit, was added to the Java Core in version 1.0, way back in the 1990s. It uses native widgets to display GUI components on the screen. However, in AWT, we are left with the least common denominator limitation: only widgets that exist on all platforms are supported. A widget is a component like a textbox, or a button, or a tree. So, because the OS 'Motif' doesn't supply a native tree widget but Windows does, AWT does not
include a tree widget.
By the late 90s though, the concept of "Skins" in applications came in to the scene and also the requirement that an application written on one platform look the same on all platforms. This sounded very impractical for a library which aimed at being platform dependent.
In 1997, Sun and Netscape joined forces and created the Swing/Java Foundation Classes (JFC) library from the IFC (Internet Foundation Classes) that Netscape had created for Java, and the Java2D engine, along with a ton of other bits and bobs.
Originally this was released as a separate library, but was added to the Java Standard Edition from 1.2 onwards.
Swing implements widgets on its own so is not dependent on the OS to supply widgets. This gives Swing incredible flexibility regardless of native support and the introduction for support of a pluggable 'Look and Feel' or skin was very popular.
Here is an example of the same program, but with different skins that change the 'Look and Feel'.
(Thanks to L2FProd.com
In the next section, we will look at the structure of a Java GUI, and how to start developing your own.