Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Please Help! Ccan display a jpeg file!

0 views
Skip to first unread message

ltsorrillo

unread,
Jan 5, 1999, 3:00:00 AM1/5/99
to
Hi, (my email address is ltsor...@erols.com or jea...@hotmail.com)
I can't get an image to laod and be displayed in my applet. The code
compiles, but after typing the following :
appletviewer TestApplet.html
I get an applet, but no picture:the following is my TestApplet.java
code:

//Load an image and display it in its original size
import java.awt.*;
import java.applet.Applet;

public class TestApplet extends Applet
{
Image nicey;

public void init()
{
setBackground(Color.blue);
String file = "/***/***/jjava/" + "filename.jpg";
nicey = getImage( getDocumentBase(), "filename.jpg" );


}

public void paint(Graphics g)
{
g.drawImage(nicey, 1, 1, this);
}

}

here is my TestApplet.html code:
<HTML>
<HEAD>
</TITLE>TEST APPLET</TITLE>
</HEAD>
<BODY>
Here is an applet
<P>
<APPLET code="TestApplet.class" width=800 height=800>
</APPLET>
</P>
</BODY>
</HTML>

Here are the errors I'm receiving
java.lang.UnsatisfiedLinkError: readImage
at
sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:137)
at
sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:265)

at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:151)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:127)


At this point nothing else happens, the blank applet just sits there.
Can you please help me
Thank you very much!


bu...@bigfoot.com

unread,
Jan 5, 1999, 3:00:00 AM1/5/99
to

What is the

> String file = "/***/***/jjava/" + "filename.jpg";
for? You define it there, but then you don't use it.

In the statement


> nicey = getImage( getDocumentBase(), "filename.jpg" );

you're telling getImage() that the image file is in the same directory
as the HTML file. Make sure that is the case. Also, make sure that
the image file is world-readable.

Hope this helps.

- Bugar

On Tue, 05 Jan 1999 00:08:58 -0500, ltsorrillo <ltsor...@erols.com>
wrote:

0 new messages