I have a problem with print everything of a canvas class. I explain you in details..........

I have two classes, suppose A and B. A class extends JApplet and implements all the listeners. B class extends Canvas class for drawing different geometrical shapes.

I have created an object of B class within A, and within actionPerformed() method of class A, I want to execute some code for printing all the drawings of Canvas class(B class). For this I have used getPrintJob(Frame frame, String title, width, height) method. But the problem is, getPrintJob() supports Frame object as its first parameter, neither JApplet nor Applet object.

But I need JApplet or Applet, bcoz Its need to run within browser. And another thing is, all the geometrical shapes are in 2D. //(Graphics2D)

So how can I solve it? Please give me suggestion and if it is possible for you, then provide me a working sample code.

Thanx................