tags:

views:

91

answers:

1

I am in the process of turning my java application into a web applet. So far I can export the jar, sign it, and apparently launch it. The Java loading image plays endlessly and my application's JFrame window pops up and connects to my application's server. Unfortunately, as an applet, the JFrame seems to be frozen. It never renders anything and the window's content is merely the shadows of the frame buffer of objects dragged across it.

The application version runs fine, and the applet version runs fine through Eclipse's applet player. It's only on the web that the rendering craps out. I thought that signing the applet would let it work as it did as an application.

It seems that making an application into an applet is a bit more complicated than I first anticipated. What considerations should I make when making this conversion?

+1  A: 

If you can see the applet's console, you might be able to see an exception there.

You might also want to set an AWT uncaught exception handler:

static public final class UncaughtAwtExceptionHandler {
 public static void installAsUncaughtAwtExceptionHandler() {
  System.setProperty("sun.awt.exception.handler", 
      UncaughtAwtExceptionHandler.class.getName() );
 }
 public UncaughtAwtExceptionHandler() {
  /* Nothing to construct */
 }
 public void handle(Throwable ex) {
  /* Do something here to transmit the exception 
     to your server, or log it, or whatever */
 }
}

Since an exception on the AWT thread is probably what's causing your problem, this will give you the option of better discovering what that problem is.

Jon Bright