|
Java Foundation Classes
(JFC) is a new graphic framework developed through a collaboration
of Sun, Netscape and IBM. It is a mixture of Abstract Window ToolKit
(AWT) and Internet Foundation Classes
(IFC), with some improvements. However, this new framework
has some problems within Netscape browsers: Applets must extend
JApplet class instead of Applet class.
The
JApplet class is slightly incompatible with java.applet.Applet.
JApplet contains a JRootPane as its only child. The contentPane
should be the parent of any children of the JApplet. This is different
than java.applet.Applet. For example, to add a child to an java.applet.Applet
you would write:
applet.add(child);
However
using JApplet, you need to add the child to the JApplet's contentPane
instead:
applet.getContentPane().add(child);
The
same is true for setting LayoutManagers, removing components, listing
children, etc. All these methods should normally be sent to the
contentPane() instead of the JApplet itself. The contentPane()
will always be non-null.
JFC
is packed in several JAR files: swing.jar, windows.jar, motif.jar,
etc., and usually, you need more than a single one in your developments.
Netscape only supports multiple JAR file in the archive HTML tag
in 4.0.5. For previous versions, you must extract all the files
and create a new JAR archive with all the resources.
Finally,
there is a known problem with the window refresh. At times you
may need to minimize the browser or move the cursor over it to
refresh the applet. JavaSoft has said they are working around this
problem. (You can read README.TXT file which came in the Swing
package.)
To
avoid these problems, there are two solutions: use the Project
Java Activator EarlyAccess3 plug-in; or, wait for the OpenJava
API release.
|