I got a assignment to create a JInternalFrame
that can call mutiple of my applet work (last assignment call SpherePainter
) and can count how many 'applets' are running inside the JinternalFrame
.
[the applet are running inside another JInternalFrame
]
public class MyInternalFrame extends JInternalFrame {
static int openFrameCount = 0;
static final int xOffset = 30, yOffset = 30;
public MyInternalFrame() {
super("SpherePainter #" + (++openFrameCount),
true,
true,
true,
true);
setSize(500,500);
//Set the window's location.
setLocation(xOffset*openFrameCount, yOffset*openFrameCount);
SpherePainterApplet sp = new SpherePainterApplet ();
sp.init();
this.add(sp);
}
}
I can call the applet with no problem, but I cannot count how many of them are 'actually' running.
My method is to checkApp++
when one applet is create and checkApp--
when one is closed.
Is there a way to use listener of closing button (X) or similar?