Getting started

his chapter tells you how to get started using the IFC library. It includes information on installing the IFC, setting up the IFC environment, building an application, and launching an application created with the IFC.


What is the IFC?

The IFC is a library that simplifies the task of creating Java applications The designers of the IFC have worked as application developers and understand the frameworks, objects, and APIs that you need.

The following list summarizes the objectives of the IFC:

About the Windowing IFC packages

The Windowing IFC library contains Java packages that provide frameworks for application development. The frameworks include user interface components and services for Java applications.

The Windowing IFC contains the following Java packages:

These packages are documented in the IFC Reference as well as in this book.

The Windowing IFC structure

The Windowing IFC contains classes and frameworks that you use to create applications.

Table 1.1 describes what's inside the Windowing IFC.

Windowing IFC frameworks
Framework

Description

Drawing/event framework

Directs events to interface objects and allows those objects to draw themselves.

Fundamental application components

Creates basic GUI application components, such as buttons, sliders, and text fields.

Composite components

Creates more complex interface components, such as the color chooser and font chooser.

Multifont text object

Displays multifont text as well as embedded images.

Windowing framework

Creates a traditional windowing environment within a Java application, and also lets you place IFC components within native windows.

Animation framework

Supports animation, including buffered drawing and transparency.

Drag-and-drop framework

Supports dragging and dropping of items within an application.

Timers framework

Supports concurrent behavior without the need to spawn threads.

Object persistence framework

Allows objects to save their essential state, so that they can be reconstituted at a later time.


Installing the Windowing IFC

The Windowing IFC is delivered as a compressed file with a platform-specific name. When you decompress this file, the IFC creates a directory called ifc10 with the following subdirectories:

The IFC library is delivered in the classes subdirectory beneath the install directory. To access the packages in the IFC library, place the classes directory in the classpath of the Java Development Kit (JDK) compiler as described in the following platform-specific instructions.

See the Sun JDK documentation for more information about CLASSPATH.

Windows 95 installation

Follow this procedure to set up the IFC for use on a Windows 95 platform:

  1. Decompress the IFC delivery file. The ifc10 directory is created underneath the installation directory.

  2. Specify the location of the IFC packages in the CLASSPATH environment variable. For example, if you created the ifc10 directory at the root of drive C:, enter the following line in your autoexec.bat file:

              SET CLASSPATH=C:\ifc10\classes; %CLASSPATH%
  3. Reboot your machine and confirm that the environment variable is set properly.

Windows NT installation

Follow this procedure to set up the IFC for use on a Windows NT platform:

  1. Decompress the IFC delivery file. The ifc10 directory is created underneath the installation directory.

  2. Specify the location of the IFC packages in the CLASSPATH environment variable. For example, if you created the ifc10 directory at the root of drive C:, double-click the System icon in the Control Panel and create a user environment variable called CLASSPATH with the following value:

              C:\ifc10\classes
    If a CLASSPATH variable already exists, append the new path to it using a semicolon as a separator:

              D:\JDK\javalib\classes.zip;C:\ifc10\classes
  3. Reboot your machine and confirm that the environment variable is set properly.

Unix installation

Follow this procedure to set up the IFC for use on a Unix platform:

  1. Decompress the IFC delivery file. The ifc10 directory is created underneath the installation directory.

  2. Specify the location of the IFC packages in the CLASSPATH environment variable. For example, if you created the ifc10 directory in ~/lib, enter the following command:

              setenv CLASSPATH=~/lib/ifc10/classes
  3. Reboot your machine and confirm that the environment variable is set properly.

Macintosh installation

You cannot specify a CLASSPATH environment variable on the Macintosh. To use the IFC class library, you must make sure that it resides in the proper location.

Follow this procedure to set up the IFC for use on the Macintosh:

  1. Decompress the IFC delivery file. The ifc10 folder is created underneath the installation folder.

  2. Create the following folder within the System folder: Preferences|Netscape|Java|netscape-classes

  3. Copy the contents of the decompressed ifc10|classes folder into the netscape-classes folder you created. At this point, the netscape-classes folder should contain the netscape|application and the netscape|util folders.


Setting up the IFC environment

Make sure you complete the following items before you begin coding with the IFC:


Building an application

Make sure you include the file NetscapeApplet.java in your code base and compile it with your application. You use the NetscapeApplet class to load an IFC applet. NetscapeApplet.java is delivered with each application in the examples subdirectory.

To build an IFC application, issue the following command in the application's code base:

javac *.java
If the IFC class library is not in your classpath, you will see an error similar to the following when you attempt to build:

NetscapeApplet.java(4):
                    Package netscape.application not found in import.

Launching an applet

Use the following HTML syntax to launch an IFC applet:

<APPLET CODE="NetscapeApplet" WIDTH=width HEIGHT=height>
          <PARAM NAME="ApplicationClass" VALUE=appName>
</APPLET>
The NetscapeApplet class loads an IFC applet. You must specify NetscapeApplet as the value of the CODE attribute and ApplicationClass as the value of the NAME attribute. For the appName value, specify the name of the .class file that you want to launch. The file that you launch must be a subclass of Application.

If the IFC class library is not in your classpath, you will see an error similar to the following when you attempt to launch an applet:

java.io.FileNotFoundException:\F:\project\Simple\FoundationApplet.class