Tuesday, April 28, 2009

Applet GWT Integration

Due to some special reasons, some time we still need to display applet in the web application, but thats come to one problem, how to integrate the applet into the application if we using gwt for development ?


After did some researches on internet, i found there is one library called GWTAI. This gwtai contains a number of utilities and helper classes, helps developer easily integrate the Java applet to GET projects. Unfortunately, this gwtai is not working under java 6 due to some reason, therefor i need to look another way for applet gwt integration.

At the end I found another way which is using the GWT HTML class to embed the plain HTML tag in the gwt. This can let the browser interpreted the tag and display applet correctly.

HTML appletHTML = new HTML();
appletHTML.setHTML("<applet name="AppletName" code="com.package.classname.class" archive="applet_lib.jar" width=460 height=160 MAYSCRIPT>");
mainPanel.add(appletHTML);


But then another issue for this HTML way is need to handle for different browsers scenario. The applet tag is not working on every browser automatically, and developer also need to make sure the applet classes/jars are locate at the correct path in order to load the applet properly.

No comments: