I created a JFrame that loads an external applet for a game like so:
//Setup everything for the Stub.. Below adds the stub to the applet and creates it.
DownloadFile(new URL(World + "/" + Archive), "./gamepack.jar");
CAppletStub Stub = new CAppletStub(new URL(World), new URL(World), this.Parameters);
applet = (Applet) new URLClassLoader(new URL[] {new URL(World.toString() + "/" + Archive)}).loadClass("Rs2Applet").newInstance();
applet.setStub(Stub);
applet.init();
applet.start();
applet.setPreferredSize(new Dimension(Width, Height));
Frame.getContentPane().add(applet);
I'm trying to screenshot this applet or get it to draw its surface in a BufferedImage. I tried subclassing "Applet" and casting my URLClassLoader to that class but it can't cast which makes sense.
How can I capture everything the applet is rendering into an Image?