Something is probably missing me, but I cannot find the answer elsewhere. I just want to display the 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 that calls 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 run the application in host mode, jvm crash (recorded incident 1425130 with the Sun).
When I try to compile GWT code to work in a browser, I get the following:
[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 am missing some library of applets, but I went through all the jdk banks and tried to include all those that list JApplet or awt (plugin.jar, resources.jar, rt.jar, deploy.jar, javaws.jar).
In addition, I am sure that when I solve this problem, there is another one hiding right after it, but I will save it for another question.
Thanks!
An outdated application is not an applet - it is a Swing application with a thick client. We hacked it to work as an applet, because our clients need a browser client, and this is the fastest way to do this.
I donβt know if GWT will decide JPanel - the application is not written in any way that GWT can analyze - that is, it does not use the GWT API, it uses the Swing API. AFAIK, the only way to mix Swing with GWT will be in applets.
Did I miss something?