applet not displaying images
i have created a class which extends an abstract class that extends applet, and this class fails to show images when i use the graphics.drawImage command in paint.
note: i am using appletviewer
package hangman;
...
publicabstractclass Hangmanextends Applet
implements KeyListener
{
...
}
package christmas;
...
publicclass Christmasextends hangman.Hangman
{
...
private Image[]noosePosition;
private Imageescape;
privateintindex;
...
publicvoid init()
{
noosePosition =new Image[11];
for (int i = 0; i < noosePosition.length; i++)
noosePosition[i] = getImage(getCodeBase(),"images/noose" + i +".bmp");
...
escape= getImage(getCodeBase(),"images/escape.bmp");
index= 0;
...
}
...
publicvoid paint(Graphics g)
{
int x = 40;
switch (index)
{
case -1: g.drawImage(escape, 150, x, 50, 100,this);break;
default: g.drawImage(noosePosition[index], 150, x, 50, 100,this);
break;
}
...
}
}
upon winning the index is changed to -1 and each wrong guess increments the index by 1. I know that the paint command is called because other code in the paint method is executed. everything else works in the program and it produces no errors.
the directories are as such:
my stuff (base directory)
hangman (folder)
Hangman.class
[two inner classes of hangman]
jdk profiles (folder)
christmas (folder)
Christmas.class
Hangman.java
Christmas.java
images (folder)
[all bitmap images referred to in code]
Christmas.html
the html file is as such:
<HTML>
<HEAD>
<TITLE>A Christmas Program</TITLE>
</HEAD>
<BODY>
You may need to give authorization to run java applet.
<APPLET CODE="christmas\Christmas.class" WIDTH=500 HEIGHT=500>
</APPLET>
</BODY>
</HTML>

