File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Display image using getCodeBase() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Display image using getCodeBase() method " Watch "Display image using getCodeBase() method " New topic

Display image using getCodeBase() method

Akmal Zahdi

Joined: Apr 09, 2005
Posts: 13
Hiii every1...

I'm still study java by doing and understand the tutorial provided by this web site in CodeBarn. At the moment, I'm doing LoadAGif tuturial. Well in this tutorial, i detect 1 mistake there. It's declare the init method

I change it to

everything is OK

But suddenly, image is not display. There're no error. I think it cannot found path of image.

The init() method is like below

I think the error is the Bold One. Can anybody fix this problem to me.
I'm really appreciate it if u could help me in this problem. Any problem u just refer it on LoadAGif file in CodeBarn..

Manuel Moons
Ranch Hand

Joined: Mar 05, 2002
Posts: 229
A. Is the image located at the same location as the class files?
B. I do not see any code that paints the image? Do you paint it?
Akmal Zahdi

Joined: Apr 09, 2005
Posts: 13
Tq Manual Moons take regards for this question. Yes, I'm idiot, but just in JAVA only. .

For the first question, the answer is yes. I already located the image same as the class file.

For the second question, I think I paint it before the image is fully downloaded. Below is the full code.

I hope u and everybody else can help me to make appear. That's for now. Tq very much.
Akmal Zahdi

Joined: Apr 09, 2005
Posts: 13

That's why I like do pogramming eventhough I'm not very good. Why I like programming. This is because It give me challenge and satisfied. Challenge because It's very difficult and many my friend say they don't want to be good in JAVA. Satisfied because I'm very happy when I can solve something I dunno.

Well, my problem about why the image is not appear already solve a minute ago. It's just very2x small error. It's extension of type file. I change it from YM02.jpeg into YM02.jpg.

It's so simple. Anyway thanx Manuel Moon cause ask me a question esp the 1st question. Tq very Much.
I agree. Here's the link:
subject: Display image using getCodeBase() method
jQuery in Action, 3rd edition