Image loading and showing problem

S

sacha.vdk

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:

-------------------------------------------------------------------------------------------------------------
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 );
}
}
-------------------------------------------------------------------------------------------------------------

The code wich causes the message is the 23rd row:

desktopimage = super.getImage(super.getDocumentBase(), "img/" +
desktopimagename);

Does anybody know something that can solve this?

Thanks in advance...
 
J

John W. Kennedy

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:

Your code makes no sense, in at least half a dozen ways. You really need
to get a good Java textbook, because whatever you're using now is only
confusing you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top