Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Applet help

Reply
Thread Tools

Applet help

 
 
greyham
Guest
Posts: n/a
 
      02-07-2005
I've developed a number of applets before but now new ones don't seem
to work. I've got a simple example...

import java.applet.*;
import java.awt.*;
public class testing extends Applet {
public void paint(Graphics g) {
int i=0;
g.drawRect(50,50,60,60);
}//paint
}//class

It compiles fine and I have a html page (testing.html) that reads...

<html>
<body>
<applet code="testing.class" WIDTH="200" HEIGHT="200"</applet>
</body>
</html>

When I view the page in IE, I get a grey rectangle and the error at the
bottom says it can't find testing.class. I keep both in the same
directory too. When I run >appletviewer -debug testing.html, I get:

Initializing jdb ...
>run

run sun.applet.Main testing.html
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>

VM Started:
The application exited

And that's it. Any thoughts? Thanks

 
Reply With Quote
 
 
 
 
klynn47@comcast.net
Guest
Posts: n/a
 
      02-07-2005
Is the HTML code exact? In the code you have, you are missing a >

 
Reply With Quote
 
 
 
 
Last Timer
Guest
Posts: n/a
 
      02-07-2005
You may have to use sun's HtmlConverter and enclose the applet class in
<object > </object> tags.

 
Reply With Quote
 
greyham
Guest
Posts: n/a
 
      02-07-2005
Thanks for the error, you're right. So it now works with appletviewer
and I see the rectangle and have time to close it, but I still get the
'uncaught' lines running the debugger. IE also doesn't find the class
file too...?

 
Reply With Quote
 
klynn47@comcast.net
Guest
Posts: n/a
 
      02-07-2005
I ran appletviewer with the debugger on my machine, and I didn't get an
error. I'm run 1.4.0

 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      02-09-2005
On 7 Feb 2005 12:28:36 -0800, greyham wrote:

> When I view the page in IE, I get a grey rectangle and the error at the
> bottom says it can't find testing.class.


You probably need to compile the applet to work for the 1.1 (MS)VM,
as it appears the IE you speak of is using it.
<http://www.physci.org/codes/javafaq.jsp#appletie>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      02-09-2005
On 7 Feb 2005 12:40:33 -0800, Last Timer wrote:

> You may have to use sun's HtmlConverter and enclose the applet class in
> <object > </object> tags.


Certainly not for the code quoted, which is compatible with even
the MSVM (Java 1.1.4).

HTMLConverter is a rather poor alternative in any case.
<http://www.physci.org/codes/javafaq.jsp#version>

Since the code is 1.1 compatible, it makes sense to
stick with the <applet> element.

If it were 1.2, use the JavaVersionApplet and the <applet> element.

If the code were 1.3+, use WebStart.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
struts/jsp/applet: sessionid doesn't work in applet for macs only Blah Blah Java 0 08-13-2003 02:51 AM
Cool Applet Cool Applet http://24.60.235.213/Grid/ Alisher Fatykhov Java 1 08-06-2003 04:32 AM
Re: newbie: Join JApplet & Applet in one applet Andrew Thompson Java 0 08-05-2003 01:41 PM
Re: play wave files using java.applet.Applet webster Java 0 07-20-2003 01:51 PM
applet vs. canvas in applet Rob Love Java 1 07-07-2003 10:07 PM



Advertisments