Next: Web History =>

User Interfaces - Java History

Sun wanted to develop application programs that would run exactly the same on all systems. Originally the project was to program the cable TV set top boxes from various vendors, but with the increased importance of the World Wide Web the project switched to browsers. When no existing language would meet the requirements, they designed a new programming language called "Java".

The first version of Java supported the common user interface elements through what is called the Abstract Windows Toolkit or "AWT". The programmer asks the Java runtime to create a Java object that corresponds to one of the standard user interface elements. For example, to create a checkbox the Java source contains an expression for a "new Checkbox()". Under the covers, the runtime asks the operating system to create whatever the host operating system (Windows, Mac, Unix) normally uses as a checkbox.

The problem was that each operating system had slightly different rules for the size and shape of a checkbox, button, or text input field.  If an application had a large window with few elements widely separated, then there was room to expand and contract without changing the layout. In the real world, applications packed information tightly together and the switch to another system could mess up the entire layout.

[FrontPage Save Results Component]

The solution was a second generation Java interface called Swing. The Java program created a Swing checkbox by creating an object of type "JCheckBox". For this object, the Java runtime asked the operating system for a rectangle on the screen with a certain height and width. The system must notify Java if the user clicks a mouse inside the rectangle. It then asked the operating system to draw in that rectangle an empty box: . If the user clicks a mouse in the rectangle, then Java asks the system to erase the image on the box and replace it with a new box with a check mark: . Click the mouse again and the image goes back to the empty box.

Swing required Java to duplicate work and logic that each operating system already provided. However, through Swing Java could control the exact size and look of each GUI element. An application would look exactly the same on Windows, Unix, and the Mac.

(c) Copyright 2003 Howard Gilbert