drawing an image

im trying to learn java and im writing an applet to draw an image to the screen. It runs but no image appears any help appreciated, and i do have the image in the same directory as the class files

import java.applet.Applet;

import java.awt.*;// we need the awt to use the type Image

import javax.swing.*;

public class heresJohnny extends JApplet

{

private Image image;

public void init( )

{

image = getImage(getDocumentBase( ), "johnny.gif");

}

public void paint( Graphics g )

{

g.drawImage( image, 1, 1, this );

}

}

[614 byte] By [liammcmorrowa] at [2007-10-3 2:17:07]
# 1
Does the image load (or is it null), what does the console (Right click the Java cup icon in the system tray, select Console) say?
mlka at 2007-7-14 19:15:57 > top of Java-index,Java Essentials,New To Java...
# 2
I have tested your code .It compiles OK and runs without any errors! So I think that you need review you CLASSPATH and Path configuration or try using getCodeBase()have a good lucknull
LoveFreedoma at 2007-7-14 19:15:57 > top of Java-index,Java Essentials,New To Java...
# 3

i checked the console and it just says

Java Plug-in 1.5.0_07

Using JRE version 1.5.0_07 Java HotSpot(TM) Client VM

User home directory = C:\Documents and Settings\Liam

-

c:clear console window

f:finalize objects on finalization queue

g:garbage collect

h:display this help message

l:dump classloader list

m:print memory usage

o:trigger logging

p:reload proxy configuration

q:hide console

r:reload policy configuration

s:dump system and deployment properties

t:dump thread list

v:dump thread stack

x:clear classloader cache

0-5: set trace level to <n>

-

nothing of any use, at the bottom of the browser it says applet started and it compiles with no errors yet no image shows. i have also tried the suggested getCodeBase() as well but that did not work either. any ideas?

liammcmorrowa at 2007-7-14 19:15:57 > top of Java-index,Java Essentials,New To Java...
# 4
its ok its working nowthanks for all your help
liammcmorrowa at 2007-7-14 19:15:57 > top of Java-index,Java Essentials,New To Java...