Introduction to Web Programming
AFC and JFC
- The first set of interface classes for
Java, the Abstract Window Toolkit (AWT), has actually been part of
the Java Development Kit almost since its inception. The JDK 1.0
contained the AWT and was officially released in January of 1996. To
put this in perspective, Java itself was announced in May of 1995,
seven months earlier.
- The AWT, however, suffered and still suffers
from a number of technical problems primarily driven by the fact that
it is not totally written in Java. In some cases, the AWT relies on
peer classes that are, by definition, platform specific. If you
create an AWT button on a Windows platform, a native Windows button
will be created in a peer class. If the same program runs on a UNIX
machine, a Motif (UNIX user-interface) button will be created in a
peer class instead.
- Since the AWT relied upon peer classes and
native code that were platform specific, it had (and still has) many
technical problems with platform specific bugs. It also was very hard
to maintain and extend. A developer working on a Windows or Macintosh
platform could find a bug in a user-interface object which would not
exist on the Sun platform. Developers would need to test their
programs on each platform to ensure user-interface consistency and
quality. Peer classes also make the interface hard to extend. To add
a new interface object for Java, you would need to determine the
appropriate native objects to use on each platform and then create
peer classes for the native objects on each different platform.
- Many developers quickly ran into the
limitations of the AWT classes in early 1996. One such group of
developers particularly relevant to the advancement of Java
user-interface tools worked at a small startup company called
Netcode. They created a set of interface classes designed to offer
more functionality than the AWT and to fix the most basic problems
caused by the AWT's native code and peer classes.
- Netcode's classes were written in pure Java
and only used the most basic peer classes in the AWT: Window,
Graphics, Font and Event classes. Their classes would basically
create a single AWT window and offered methods that allowed you to
add buttons, text fields and other items to the window. Their classes
also performed all the management of drawing and dealing with
user-input. This made their classes extremely portable and easily
extensible since they did not rely on many platform specific classes.
When you wanted to add new features to a button, for example, you
could simply write code in Java to do it, instead of having to deal
with platform-specific peer classes. Netscape liked Netcode's classes
and purchased the company in March of 1996. Netscape then released
these classes as the Netscape IFC (Internet Foundation
- Sun and Netscape continued to refine and
improve the AWT and the IFC, respectively. Then, in October of 1996,
Sun released the JavaBeans API that defined a new standard API for
Java components. Since Netscape IFC and Sun's AWT were both written
prior to the JavaBeans API, both needed some major work to conform to
the new specification.
- Many other companies were also developing
interface objects at this time, filling in the areas where the AWT
and IFC lagged. One such company, Microline Software, was extremely
successful in selling an interface toolkit containing tables, trees
and other advanced components for the AWT and IFC.
- It looked like the world was headed toward
two diverging standards for user-interfaces in early 1997, but then
on April 2nd came a flurry of announcements from the major industry
players. On the same day, Netscape, Sun and Microsoft announced new
foundation classes for creating user-interfaces in Java. Netscape and
Sun (Javasoft) announced the JFC (Java Foundation Classes) and
Microsoft, until now quietly watching from the sidelines, announced
the Microsoft Application Foundation Classes (AFC).
- Unlike the AWT and the IFC, the AFC and JFC
are each a complete set of foundation classes. Both contain all the
basic user-interface components users have come to expect in modern
applications including multi-column lists, trees and tabs. They also
both offer a 2D graphic API with advanced drawing support.
- The announcements left a lot of developers
wondering what to do for user-interface development. Now, instead of
two major sets of foundation classes (the AWT and IFC) to choose
from, there were four. However at this stage, the JFC and AFC were
just announcements, with neither scheduled to release for months.
So, most developers continued to sit on the sidelines until the newly
announced foundation classes shipped and continued to work with both
the AWT and IFC until late 1997.
- On October 7, 1997 Microsoft released the
SDK 2.0 for Java which included the Microsoft AFC. Like Netscape IFC,
the AFC is written entirely in Java without the use of peer classes.
Also like the IFC, it does rely on the AWT for its basic functions.
For example, it creates windows and receives events using some of the
AWT's basic classes. This allows it to run anywhere these basic AWT
classes are available, including in Netscape Navigator and with
Sun's JDK for UNIX.
- There are actually two versions of the AFC.
One works with Microsoft's Java Virtual Machine that comes as part of
Microsoft Internet Explorer and JDK 1.1 and another that works with
the JDK 1.02. The AFC is optimized to work with Microsoft's
implementation of Java and should provide higher performance and less
system resource use with Microsoft's own Java implementation.