Hi, I'm probably missing something simple here, but I can't find the answer elsewhere. I just want to display an applet in my GWT code.
OS: Windows XP Java: JDK 1.6.0_10 Other: GWT, GWT-Ext 2.0.5
Here is the applet (obviously simplified for testing):
package foo.applet;
import javax.swing.JApplet;
import java.awt.Graphics;
public class HelloApplet extends JApplet
{
public void paint(Graphics g)
{
g.drawRect(0, 0,
getSize().width - 1,
getSize().height - 1);
g.drawString("Hello world!", 5, 15);
}
}
Here is the code calling it:
package foo.applet;
import com.google.gwt.user.client.ui.HTML;
import com.gwtext.client.widgets.Panel;
public class AppletPanel extends Panel
{
public AppletPanel()
{
HTML applet = new HTML();
applet.setHTML("<applet name=\"HelloApplet\" code=\"HelloApplet.class\" width=\"300\" height=\"300\"" );
this.add(applet);
}
}
When I launch the app in hosted mode, the jvm crashes (filed incident 1425130 with Sun).
When I try to compile the GWT code for running in a browser, I get this:
[ERROR] Errors in 'file:/C:/<blah>/applet/HelloApplet.java'
[ERROR] Line 3: The import javax.swing cannot be resolved
[ERROR] Line 4: The import java.awt cannot be resolved
[ERROR] Line 6: JApplet cannot be resolved to a type
[ERROR] Line 8: Graphics cannot be resolved to a type
[ERROR] Line 11: The method getSize() is undefined for the type HelloApplet
[ERROR] Line 12: The method getSize() is undefined for the type HelloApplet
Obviously I'm missing some applet library, but I've grepped through all the jars in the jdk and tried including all of the ones that list JApplet or awt (plugin.jar, resources.jar, rt.jar, deploy.jar, javaws.jar).
Also, I'm pretty sure once I solve this problem there's another one lurking right after it, but I'll save that for another question.
Thanks!