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.
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