//////////////////////////////////////////////////
// Graphit.java                                //
// Copyright © 1998-2001 Alan Cooper.         //
///////////////////////////////////////////////
In Java code, anything from ' // ' to the end of a line is a comment (as is also anything bracketed between '/*' and '*/'), so the above header is not part of the program.
The following 'import' statements are not essential but allow short names to be used for the components. They would be the same for any program using the qpr.math classes.
import qpr.util.beanstuff.*; import qpr.math.plotkit.*;
import qpr.math.alg.*; import qpr.math.d2g.*;
import qpr.math.svf.*; import qpr.math.grf.*;
import qpr.util.colorstuff.*;import qpr.util.*;
import java.awt.*;import java.beans.*;
import java.applet.Applet;

Any publicly accessible java class definition starts like this
public class Graphit
and an extends clause may be used to identify the definition as being an extension of that of some other class
extends AppletAppBean
A qpr.util.beanstuff.AppletAppBean can be run either as an application or an applet and has some additional event handling capabilities (the import qpr.util.beanstuff.*; in the header allows us to refer to it by just the last part of its name)
Blocks of code (including e.g. class and method definitions) are enclosed in braces.
{
First we identify the components to be used in the applet.
GraphWindow gw=new GraphWindow();
(this is the standard Java construction for creating a new element of a class)
GraphSetManager gsm=new GraphSetManager();
(the GraphSetManager has a built-in ColorSelectPanel, and that is the one we want to use)
ColorSelectPanel csp=gsm.getColorSelectPanel();
(and similarly for the FunctionSetManager and ParamSetManager)
FunctionSetManager fsm=gsm.getFunctionSetManager();
ParamSetManager psm=gsm.getParamSetManager();
These initializing assignments in these declarations could have been postponed and included in the 'constructor' method below, but I put them here just for compactness.

Most Java classes have explicit publicly accessible 'constructor' methods (whose name is the same as the class name) which are to be called whenever an instance of the class is loaded.
This Graphit() constructor specifies the arrangement and connections of the components.
public Graphit(){
 setSize(800,500); setLayout(null);
(This is needed to allow absolute positioning of the components as below, since Java's default for applets is to lay them out in a flexible pattern that can adjust to window size - which is often preferable but is harder to explain and leads to less easily predictable results)
 add(gw);gw.setBounds(200,0,400,480);
 add(gsm);gsm.setBounds(0,0,200,200);
 add(csp);csp.setBounds(0,200,200,200);
 add(fsm);fsm.setBounds(600,200,200,200);
 add(psm);psm.setBounds(600,0,200,200);
After specifying the position of each component (in pixels relative to the top left corner of the applet in the form top left corner coordinates followed by width and height), (and having already specified the logical dependencies of the csp, fsm, and psm on the gw), all that remains to tell the GraphWindow to display the contents of the GraphSetManager.)
gw.show(gsm);
}
 

The remainder of the code would be almost identical for any other applet built from these tools (the only difference being in the class constructor name used in the new statement of main and possibly the arguments of  setSize in  init()) so there is no real need to look at it in detail.

But for the sake of anyone who is interested and doesn't already know:

When an applet is loaded, its constructor is followed by an init() method
public void init(){setSize(800,500);}

And for a class to run as an application it must have a main method whose definition always starts like this
public static void main(String[] args){
(the 'keywords' static and void indicate that it can be called before any instance of the class has been created and that it doesn't produce any return  value, and its argument String[] args indicates that its command line can include a list of String arguments - although in this case we shall have no need of that possibility).
What we want the program to do is just create an instance of the class and then display it
 AppletApp a=new Graphit();
Since Graphit extends AppletAppBean which in turn  extends AppletApp , the newly created instance of Graphit  'inherits' the AppletApp's  frameIt method which does the job of creating and filling the frame
 frameIt(a);      }
 

}//endClass(Graphit)
The closing brace ends the class definition
(and the rest of the line is just a comment to help me keep count of closing braces)