What does the \"J\" in JApplet mean?
The 'J' was first put out by the KL Group (now quest.com) whose revolutionary BWT forms the basis of today's Improved AWT called Swing /JFC.
So, it comes from the ancestor of today's KL JClass:
(not so, according to TofuBeer's answer: I leave the rest as a Community Answer because it details what was JClass, but the 'J' may not come at all from the integration of their library into Swing.)
JClass SwingSuite, a new set of extensions and enhancements for Swing in Sun Microsystems, Inc.'s Java(TM) Development Kit (JDK(TM) version 1.2): it coincides with Sun's announcement of the availability of JDK 1.2 made today during the Java(SM) Business Expo(SM) in New York.
JClass JavaBeans
are available in many popular Java IDEs and are the essential components used by professional and corporate developers around the world.
JClass 3.6 includes "J" versions, which work with the javax.swing package enabling the development and deployment with JDK 1.2 today.
From JClass 3.6 to 4.0 Porting Guide and KL Group Releases Swing Update for JClassLine (march 1998):
To accommodate the various types of environments Java developers may be using, we have developed versions of our JClass products that can be used for specific Java Development Kits (JDKs). The following lists the differences between the different versions:
- "J" version: uses JDK 1.1 + Swing 1.1 (JDK 1.1.8 + Swing 1.1.1 are recommended)
- "K" version: uses Java 2 (JDK 1.2.2 is recommended)
JClass 3.6 and prior versions used a slightly different letter scheme, which is as follows:
- "T" version: uses the JDK 1.0.2 API and implements "Transitional" JavaBeans
- "Unlettered" version: uses the JDK 1.1.x and incorporates full JavaBean implementation
- "S" version: uses the JDK 1.1/Swing 1.0.3
- "J" version: uses JDK 1.2 or JDK 1.1 with Swing 1.1
A bit of general context:
From The Basic Java Applet and JApplet:
The AWT (Abstract Windowing Toolkit) has been part of Java from the beginning, but, almost from the beginning, it has been clear that the AWT was not powerful or flexible enough for writing complex, sophisticated applications.
This does not prevent it from being useful -- especially for applets, which are generally not as complex as full-scale, independent applications.
The Swing graphical user interface library was created to address the problems with the AWT. With the release of Java version 1.2, Swing became an official part of Java. (Versions of Java starting with 1.2 are also called, rather confusingly, "Java 2.")
There are still good reasons to write applets based on the AWT, such as the lack of support in many Web browsers for Java 2. However, at this point, anyone writing a stand-alone graphical application in Java should almost certainly be using Swing.
The classes that make up the Swing library can be found in the package
javax.swing
. Swing includes the classjavax.swing.JApplet
to be used as a basis for writing applets.
JApplet
is actually a subclass ofApplet
, soJApplets
are in factApplets
in the usual sense.However,
JApplets
have a lot of extra structure that plain Applets don't have. Because of this structure, the painting of aJApplet
is a more complex affair and is handled by the system.So, when you make a subclass of
JApplet
you should not write apaint()
method for it. As we will see, if you want to draw on aJApplet
, you should add a component to the applet to be used for that purpose. On the other hand, you can and generally should write aninit()
method for a subclass ofJApplet
.
Swing is a large set of components ranging from the very simple, such as labels, to the very complex, such as tables, trees, and styled text documents.
Almost all Swing components are derived from a single parent called JComponent
which extends the AWT Container
class.
Thus, Swing is best described as a layer on top of AWT rather than a replacement for it.
If you compare it with the AWT Component hierarchy, you will notice that for each AWT component there is a Swing equivalent with prefix “J
”.
The only exception to this is the AWT Canvas
class, for which JComponent
, JLabel
, or JPanel
can be used as a replacement. Many Swing classes have no AWT counterparts.
When Sun started working on Swing they had things like javax.swing.Button. This caused problems for programs that mase use of java.awt.Button. The main issue, if I remember right, was that the compiler error messages were confusing.
Sun decided to prefix all of the Swing components with J to remove this issue.
Originally swing was called JFC - Java Foundation Classes... presumably the J came from that.
IFC from Netscape was the foundation for JFC... the same team developed both.
The team moved from Netscape to Sun.
The J was there at the first source drop to licensees (I was the person why received the drop at my company).
The JClass BWT and the IFC (which became the JFC, which became Swing) were incompatible as well... "Can I use BWT controls in an IFC environment?"
Edit: Response to an email from a member of the Swing team...
"The un-J'd names were already taken by AWT and we thought it useful to use a common prefix to distinguish "components" from other classes in the package."
The already taken part does match with what I said about the compiler, but does not confirm it.
J stands for Java. The main difference between the JSomeName classes and their "previous" version, is that the J-ones where designed to be used with Swing (or any other graphical toolkit), while the others are from this time where only AWT was available.
The J comes after the convention used in Swing classes.
According to the javadoc:
An extended version of java.applet.Applet that adds support for the JFC/Swing component architecture
JFC/Swing architecture is different from AWT architecture.
There are several differences, but the most significant is, AWT uses native code to render widgets ( so does SWT ) while Swing is "light weight" because all the is painted using Java.
So the answer to your question
What does the "J" in JApplet mean?
It means it is an Applet that supports Swing architecture.
I think TofuBeer and VonC are great answers, but they don't address ( at least directly ) your question. Instead they go further explaining why the J in swing components and should not be confused with tons of other J's in front of other classes outside Sun.