JOGL to Japplet error............

Hi,
i have the following jogl application, i m getting this error while porting it to japplet. Please help me debug my problem:

Error:
Graph.java:23: cannot find symbol
symbol : constructor DrawGraph(Graph,double,double,double,double,boolean,boolea
n)
location: class DrawGraph
final DrawGraph graph = new DrawGraph(this, a, b, delta, speed,fancy, mo
ving);
^

JOGL Application: (There are 3 files) Graph.java, DrawGraph.java. SimpleGLCanvas.java

Graph.java:

import java.awt.;
import java.awt.event.
;
import javax.swing.;
import java.applet.
;

public class Graph extends JApplet
{
public Graph(final double a, final double b, final double delta,final double speed,final boolean fancy, final boolean moving)
{
// — Drawing area
final DrawGraph graph = new DrawGraph(this, a, b, delta, speed,fancy, moving);

    // --- Menubar

    final JMenuBar menubar = new JMenuBar();
    setJMenuBar(menubar);

    final JMenu menu = new JMenu("File");
    // Ensure popup menu is drawn in front of OpenGL window
    // (by not using a lightweight window for the menu)
    menu.getPopupMenu().setLightWeightPopupEnabled(false);
    menubar.add(menu);

    // Exit when quit selected
    final JMenuItem quitm = menu.add("Quit");
    quitm.addActionListener(
        new ActionListener()
        {
            public void actionPerformed(final ActionEvent e)
            {
                System.exit(0);
            }
        });

    // Exit when window closes
 /*    addWindowListener(
        new WindowAdapter()
        {
            public void windowClosing(final WindowEvent e)
            {
                System.exit(0);
            }
        });
    */ 
    // ------------------------------------------------------

    // Lay out main window
    final Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(graph, BorderLayout.CENTER);
    //pack();
    setVisible(true);

    // Placement of window on screen
    setLocation(100, 50);
    this.setSize(350, 380);

    // Start animation
    graph.setAnimation(true);
}

public static void main(final String args[])
{
    boolean fancy = false, moving = false;
    double a = 5, b = 4, delta = 0, speed = 1;

    // Parse command-line arguments
    try {
        for (int i = 0; i < args.length; i++) {
            if (args[i].equals("-help")) {
                System.out.println("Usage: java Graph " +
                                   "[-fancy] [-a #] [-b #] [-delta #] " +
                                   "[-speed #]");
            } else if (args[i].equals("-fancy")) {
                fancy = true;
            } else if (args[i].equals("-moving")) {
                moving = true;
            } else if (args[i].equals("-a") && i+1 < args.length) {
                a = (new Double(args[++i])).floatValue();
            } else if (args[i].equals("-b") && i+1 < args.length) {
                b = (new Double(args[++i])).floatValue();
            } else if (args[i].equals("-delta") && i+1 < args.length) {
                delta = (new Double(args[++i])).floatValue();
            } else if (args[i].equals("-speed") && i+1 < args.length) {
                speed = (new Double(args[++i])).floatValue();
            } else {
                throw new Exception("Illegal argument: " + args[i]);
            }
        }
    } catch (final Exception e) {
        System.out.println("Error: " + e.getMessage());
        System.exit(1);
    }

    // Create main window
    try {
        final Graph g = new Graph(a, b, delta, speed, fancy, moving);
        g.setVisible(true);
    } catch (final Exception e) {
        e.printStackTrace();
        System.exit(1);
    }
}

}

DrawGraph.java

import javax.media.opengl.*;
import java.awt.Window;
import java.lang.Math;

public class DrawGraph extends SimpleGLCanvas
{
boolean fancy, moving;

   double a, b, delta;

   double speed; // Animated drawing speed

   double x,y,z,r,b1,i;

  public DrawGraph(Window parent, double aVal, double bVal,double deltaVal, double speedVal,boolean fancyVal, boolean movingVal)
{
    super(parent);
    // Lissajous curve parameters
    a = aVal;
    b = bVal;
    delta = deltaVal;

    // Drawing style
    speed = speedVal;
    fancy = fancyVal;
    moving = movingVal;
}

// Method for initializing OpenGL (called once at the beginning)
public void init(GL gl)
{
    // Set background color to black
    gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}

// Method for handling window resizing
public void projection(GL gl, int width, int height)
{
    // Set drawing area
    gl.glViewport(0, 0, width, height);

    // Set up orthographic projection with
    // window coordinates slightly larger than [-1,1]x[-1,1]
    gl.glMatrixMode(GL.GL_PROJECTION);
    gl.glLoadIdentity();
    gl.glOrtho(-1.01, 1.01, -1.01, 1.01, -1.0, 1.0);
    gl.glMatrixMode(GL.GL_MODELVIEW);
}

// Method for drawing the contents of the window
public void draw(GL gl)
{
    double time = readClock();

    // Clear the window
    gl.glClear(GL.GL_COLOR_BUFFER_BIT);

  	gl.glBegin(GL.GL_LINE_STRIP);
          for(i = 0;i<=2*3.14;  i += 2*3.14/100)
              {

	      gl.glColor3d(0.5+i/1.3*0.5,0.5+i/1.3*0.5,0.5+i/1.3*0.5);
	        x = Math.sin(a * (time*speed + i)+ delta);
                    y = Math.sin(b * (time*speed + i));

		     if(moving)
		        { x = Math.sin(a * (time*speed + i) +i+ delta);
                              y = Math.sin(b * (time*speed + i)+i);
			}

		            if(fancy)
		              gl.glColor3d(i*0.3,i,0.6);

		  gl.glVertex2d(x,y);
              }


    gl.glEnd();
    gl.glFlush();
}

}

SimpleGLCanvas.java
import javax.media.opengl.;
import com.sun.opengl.util.
;
import java.awt.event.;
import java.awt.
;

public abstract class SimpleGLCanvas extends GLCanvas
implements GLEventListener
{
private Animator animator;

// Constructor
public SimpleGLCanvas()
{;

}
public SimpleGLCanvas(Window parent)
{
animator = new Animator(this);
parent.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
// Run this on another thread than the AWT event queue to
// make sure the call to Animator.stop() completes before
// exiting
new Thread(new Runnable() {
public void run() {
if (animator.isAnimating())
animator.stop();
System.exit(0);
}
}).start();
}
});

	addGLEventListener(this);

    // Reset timer
    resetClock();
}

// ------------------------------------------------------------
// Animation clock

// Starting time of program
public long startingTime;

// Record starting time of program
public void resetClock()
{
    startingTime = System.currentTimeMillis();
}

// Return current time (in seconds) since program started
public double readClock()
{
    return (System.currentTimeMillis() - startingTime) / 1000.0;
}

// Check if animation is proceeding
public boolean isAnimated()
{
    return animator.isAnimating();
}

// Start/stop animation
public void setAnimation(boolean on)
{
	if (on)
      animator.start();
	else
      animator.stop();
}

// ------------------------------------------------------------
// GLEventListener
public void init(GLAutoDrawable drawable) {
	init(drawable.getGL());
}

public void reshape(GLAutoDrawable drawable, int x, int y,
                    int width, int height)
{
	// Specify new projection for this window
	projection(drawable.getGL(), width, height);
}

public void display(GLAutoDrawable drawable) {
    // Draw the contents of the window (abstract method)
    draw(drawable.getGL());
}

public void displayChanged(GLAutoDrawable drawable,
                           boolean modeChanged, boolean deviceChanged) {
}

// ---------------------------------------------------------------------
// Drawing and projection functions

// OpenGL Initialization
abstract public void init(GL gl);

// Called when window is created or whenever it is resized
abstract public void projection(GL gl,
                                int width, int height);

// Called whenever window needs to be redrawn
abstract public void draw(GL gl);

}

I have commented out the code for addwindowlistener in Graph.java because it is not needed while using it as applet. The same application if run by replacing JApplet with JFrame (in Graph.java) works fine but with JApplet it gives a constructor error mentioned above.

Please help me with this problem. I am not able to debug it.

When Graph extends JApplet, is it still a subclass of Window? If it isn’t, then DrawGraph doesn’t have a constructor that takes in a Graph. My bet is that Graph is no longer a Window.

DrawGraph requires a Window as parent parameter, but JApplet does not extend Window. This is needed for the super constructor from SimpleGLCanvas, since in SimpleGLCanvas the parent is needed to attach a WindowListener to handle the windows close action.

I am afraid you will have to take a different approach to port this to an applet. I haven’t looked at its source, but I would guess the easiest way would be to take the GearsApplet from the jogl demo sources as template and replace the GLEventListener methods (init(), display(), reshape(), displayChanged()) with the drawing code from your application.