185 lines
9.5 KiB
HTML
185 lines
9.5 KiB
HTML
<!--startcut ==========================================================-->
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<title>Book Review: Netscape IFC in a Nutshell LG #28</title>
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
|
|
ALINK="#FF0000">
|
|
<!--endcut ============================================================-->
|
|
|
|
<H4>
|
|
"Linux Gazette...<I>making Linux just a little more fun!</I>"
|
|
</H4>
|
|
|
|
<P> <HR> <P>
|
|
<!--===================================================================-->
|
|
|
|
<center>
|
|
<h1><font color="maroon">Book Review: Netscape IFC In a Nutshell</font></h1>
|
|
<H4>By <a href="mailto:celestinor@acm.org">R. J. Celestino</a></H4>
|
|
</center>
|
|
<P> <HR> <P>
|
|
<ul>
|
|
<li>Authors: Dean Petrich and David Flanagan
|
|
<li>Publisher: O'Reilly and Associates
|
|
<li>E-mail: <A HREF="mailto:info@oreilly.com">info@oreilly.com</A>
|
|
<li>URL: <A HREF="http://www.oreilly.com/">http://www.oreilly.com/</A>
|
|
<li>Price: $19.95 US
|
|
<li>ISBN: 1-56592-343-X
|
|
</ul>
|
|
Netscape quietly released its Internet Foundation Classes (IFC) in the
|
|
spring of 1996. This free Java class library offers developers a welcome
|
|
alternative to the lifeless GUI widgets and basic graphics provided in
|
|
Sun's Abstract Windowing Toolkit (AWT). However, the IFC can be
|
|
intimidating even for experienced Java developers. To effectively use the IFC, you must
|
|
learn its event model and its container model, both of which differ
|
|
from standard Java. Additionally, learning the IFL's
|
|
classes and API is no small endeavor. <i>Netscape IFC in a Nutshell</i>
|
|
helps, with good explanations, examples and a handy quick reference guide.
|
|
<p>
|
|
<i>Netscape IFC in a Nutshell</i> is written by Dan Petrich and
|
|
David Flanangan. In the Nutshell tradition, it is not too big or
|
|
intimidating. The cover graphic will surely lead IFC geeks to refer to
|
|
it as ``the fish book''. It weighs in at around 350 pages, approximately
|
|
140 pages of which are the quick reference section. This same reference
|
|
information is available in HTML format from Netscape. I think it is
|
|
helpful to complement on-line documentation with a compact hard copy
|
|
reference, and I'm sure we all agree that making notes in the margin of
|
|
an HTML page can be a bit difficult.
|
|
<p>
|
|
The book is far more than an API reference. It
|
|
takes you through the IFC classes in a logical and matter-of-fact
|
|
manner. Numerous examples cover most of the important aspects of the
|
|
IFC. The examples are typically small but effective. They are well focused
|
|
on the topics at hand and help immensely with understanding.
|
|
The book does not include a CD-ROM, which is too bad as it would make a
|
|
nice addition to the book. As an alternative, O'Reilly and Associates could
|
|
have provided space on their web site for on-line examples and running
|
|
applets. Unfortunately, they didn't do that either, so be prepared to
|
|
type in each example and code fragment by hand.
|
|
<p>
|
|
The authors begin with a high-level introduction to the IFC. They discuss
|
|
its capabilities including the sophisticated GUI widgets, persistence
|
|
mechanism and the visual construction tool <i>Constructor</i>. If you
|
|
are not sure what the IFC is all about or if it's right for you, this
|
|
section is very helpful.
|
|
<p>
|
|
The next topic is an introduction to the most basic class in the IFC,
|
|
the Application Class. As an IFC user, I have noticed that the IFC often
|
|
departs from traditional Java vernacular. The Application class is one
|
|
example of many you will come across. Seasoned Java developers typically
|
|
understand <i>application</i> to mean a stand-alone Java program,
|
|
and <i>applet</i> to mean a restricted Java program that runs in a
|
|
browser. Forget all that when using the IFC. Every running IFC program,
|
|
be it stand-alone or applet, is an application. Don't worry though;
|
|
it's all explained very simply in this chapter using the power of the
|
|
venerable <b>Hello World</b> program.
|
|
<p>
|
|
Having straightened out what an application is, the book takes you
|
|
through a good explanation of the IFC's View classes. View classes in
|
|
the IFC are akin to the Container classes in standard Java, but with
|
|
differences in both architecture and capabilities. The authors devote
|
|
three chapters to a discussion of these classes. They make good use of
|
|
examples to show you many of the important features, from tiling a
|
|
bitmap on the background to drawing.
|
|
<p>
|
|
Users interact with GUIs using a mouse and keyboard. In Java, these
|
|
devices make themselves known by generating <i>events</i>. The mechanism
|
|
by which these events are made available to your program is known as the
|
|
event model. The Java standard event model has evolved over its short
|
|
lifetime. It began as an inheritance-based model, eventually maturing to
|
|
the more powerful delegation-based model used today. The IFC uses a hybrid
|
|
model. The chapter on mouse and keyboard events covers the inheritance-based model. The chapter on targets covers the IFCs implementation of
|
|
delegation-style event handling. The details of using each type of event
|
|
are discussed in reasonable detail. Numerous examples show how to code
|
|
your own event processing. However, I felt that the authors should have
|
|
contrasted the two styles better. In addition, it would be helpful if
|
|
they offered some guidelines on when to use each model.
|
|
<p>
|
|
The book moves on to cover each widget in considerable detail. Remember
|
|
that the IFC provides a replacement for every standard widget, so even
|
|
items as simple as a push-button or text field have a new API. These
|
|
chapters really drive home the power of these IFC widgets, making the
|
|
traditional widgets from Sun look absolutely bland.
|
|
<p>
|
|
I found their treatment of scrolling particularly useful. The IFC
|
|
provides a framework to support scrolling of text and graphics. While
|
|
very powerful, understanding the details can be daunting. The authors
|
|
present scrolling clearly and offer good illustrative examples. With
|
|
the details in this chapter, you will be able to add scrolling to any
|
|
application with ease.
|
|
<p>
|
|
Another excellent section is the one on layout managers. Layout managers
|
|
are classes that help View classes decide upon the size and position of
|
|
the widgets they contain. The IFC includes a powerful new layout manager,
|
|
the PackLayout. The book covers this complex layout manager in excellent
|
|
detail. Outside of this book, there is virtually no useful documentation
|
|
on the true behavior of the pack layout.
|
|
<p>
|
|
Anyone who has ever written an applet that displays images will
|
|
eventually reach the conclusion ``why don't they handle all of this mess
|
|
for me?'' Netscape's engineers felt the same way, and they did something
|
|
about it. In the chapters on images and animation, you will learn how
|
|
simply your application can read and display image files (both GIFs and
|
|
JPEGs). Creating animation is a simple matter as
|
|
well. The book explains how the IFC handles threading, sequencing and
|
|
double buffering. If you are interested in images and animation,
|
|
these chapters will get you going quickly and painlessly.
|
|
<p>
|
|
In the <i>Advanced Topics</i> section, the authors cover the details of
|
|
the TextView class, archives, and the free GUI builder Constructor.
|
|
<p>
|
|
The authors rightly spend a considerable amount of time discussing the TextView
|
|
class. They show how to use TextView to display
|
|
HTML documents, handle hyperlinks, open a mini editor and more. With all
|
|
this versatility from a single component, it is a comfort to have clear
|
|
explanations and examples to lead you.
|
|
<p>
|
|
The authors next discuss archives. Archives provide object
|
|
persistence. Every class in the IFC can be archived to disk so that it
|
|
can outlive the process that created it. The authors detail how to use
|
|
IFC archives to read and write objects in a number of situations. They
|
|
also discuss how to archive existing IFC classes and explain how
|
|
to archive classes that you have created.
|
|
<p>
|
|
Finally, you will learn how to use Netscape Constructor. Unlike the rest
|
|
of the IFC, Constructor is an application not a component. Perhaps
|
|
this is why the chapter is so skimpy. Considering this chapter is
|
|
in the ``Advanced Topics'' section, I would have expected more detailed
|
|
information. Nonetheless, the chapter does provide some good information
|
|
on few aspects of the elusive Constructor.
|
|
<p>
|
|
The GUIs that are created using the IFC are truly a pleasure to
|
|
behold. The widgets, in stark contrast to their plain Java brethren, have
|
|
a polished look and feel. Some of the components, such as TextView,
|
|
are so powerful that they could be marketed on their own. Learning such
|
|
a comprehensive class library can be downright scary.
|
|
<i>Netscape IFC in a Nutshell</i> provides numerous easy to follow examples,
|
|
detailed explanations and a quick reference guide.
|
|
<p>
|
|
Eventually, the IFC will be subsumed by the Java Foundation Classes (JFC),
|
|
a joint venture between Sun and Netscape. But if you want beautiful
|
|
user interfaces today, the IFC is the way to go, and <i>Netscape IFC in a
|
|
Nutshell</i> is a great way to get you there.
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<center><H5>Copyright © 1998, R. J. Celestino <BR>
|
|
Published in Issue 28 of <i>Linux Gazette</i>, May 1998</H5></center>
|
|
|
|
<!--===================================================================-->
|
|
<P> <hr> <P>
|
|
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
|
|
ALT="[ TABLE OF CONTENTS ]"></A>
|
|
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
|
|
ALT="[ FRONT PAGE ]"></A>
|
|
<A HREF="./poel.html"><IMG SRC="../gx/back2.gif"
|
|
ALT=" Back "></A>
|
|
<A HREF="./ayers1.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
|
|
<P> <hr> <P>
|
|
<!--startcut ==========================================================-->
|
|
</BODY>
|
|
</HTML>
|
|
<!--endcut ============================================================-->
|