Looks like you're trying to compile your Applet code with GWT.  That
will never work (not emulated; obviously you don't want to convert
your applet into Javascript, even if it were possible).  Compile it
with plain Javac outside your GWT project or on the server side of
your project and then you include the class or jar file that defines
your applet in the public directory so that it is visible to your
AppletPanel class.  Then you'll have to run your application in web
mode to test your applet.

On Jan 2, 11:39 am, DAve <smith.davi...@gmail.com> wrote:
> 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):
>
> <pre><code>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);
>     }}
>
> </code></pre>
>
> Here is the code calling it:
>
> <pre><code>
> package foo.applet;
>
> import com.google.gwt.user.client.ui.HTML;
> import com.gwtext.client.widgets.Panel;
>
> public class AppletPanel extends Panel
> {
> </code></pre>
>     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!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to