Hi,
I'm trying to make a little java application for my website, but I have
to load images. The compiling of the code gives no errors, but when I
run it, it says "Applet not initialized". I know wich row the message
causes, but I don't know how to solve it.
Here's the code:
The code wich causes the message is the 23rd row:Code:import java.awt.*; import java.applet.*; import java.awt.Image.*; public class App extends Applet { DeskTop desktop; public void init() { desktop = new DeskTop( ); } public void paint(Graphics g) { desktop.paint( g ); } } class DeskTop extends App { private String desktopimagename; private Image desktopimage; public DeskTop( ) { desktopimagename = "bg_Tiger.jpg"; desktopimage = super.getImage(super.getDocumentBase(), "img/" + desktopimagename); } public void paint( Graphics g ) { g.drawImage( desktopimage, 0, 0, super.WIDTH, super.HEIGHT, this ); } }
Does anybody know something that can solve thisCode:desktopimage = super.getImage(super.getDocumentBase(), "img/" + desktopimagename);?
Thanks in advance...
PS: what I also tried was:
add a void to my App class:
and instead of usingCode:public Image getImg( String imagename ) { Image picture; picture = this.getImage( this.getDocumentBase(), "img/" + imagename ); return picture; }
i usedCode:desktopimage = super.getImage(super.getDocumentBase(), "img/" + desktopimagename);Code:desktopimage = super.getImg( desktopimagename );


. I know wich row the message
?
Reply With Quote


Bookmarks