G
GEBUH
Hi all, I don't know diddly about java, so I started tinkering with applets and
already I hit something I can't figure out. I've borrowed a couple of books
and googled the crap outta the subject, but nothing I do seems to work.
I'm using Jcreator2.5LE compiler on my xp os. I can't get the image to
display. I even copied the code to do a simple image applet from a java
textbook- but that doesn't work either. can anyone help me?
here's my code:
import java.awt.*;
import java.applet.*;
public class HangMan extends Applet {
private Image scaffold = null;
private int width, height; //used for size of image
public void init()
{
width = getSize().width;
height = getSize().height;
scaffold = getImage(getDocumentBase(), "HangMan/reactions.gif");
//supposed to load image
//if this is done in paint, they will be redrawn everytime applet is
redrawn
}
public void paint(Graphics g)
{
g.drawString("HANGMAN", 220, 20 );
g.drawImage(scaffold, 0, 0, this);
/*if(!g.drawImage(scaffold, 0, 0, this))
{
g.drawString("Loading Picture. Please hang on",
220, 220);
} */
}
}
here's the html
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="000000">
<CENTER>
<APPLET
code = "HangMan.class"
width = "600"
height = "400"
</APPLET>
</CENTER>
</BODY>
</HTML>
already I hit something I can't figure out. I've borrowed a couple of books
and googled the crap outta the subject, but nothing I do seems to work.
I'm using Jcreator2.5LE compiler on my xp os. I can't get the image to
display. I even copied the code to do a simple image applet from a java
textbook- but that doesn't work either. can anyone help me?
here's my code:
import java.awt.*;
import java.applet.*;
public class HangMan extends Applet {
private Image scaffold = null;
private int width, height; //used for size of image
public void init()
{
width = getSize().width;
height = getSize().height;
scaffold = getImage(getDocumentBase(), "HangMan/reactions.gif");
//supposed to load image
//if this is done in paint, they will be redrawn everytime applet is
redrawn
}
public void paint(Graphics g)
{
g.drawString("HANGMAN", 220, 20 );
g.drawImage(scaffold, 0, 0, this);
/*if(!g.drawImage(scaffold, 0, 0, this))
{
g.drawString("Loading Picture. Please hang on",
220, 220);
} */
}
}
here's the html
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="000000">
<CENTER>
<APPLET
code = "HangMan.class"
width = "600"
height = "400"
</APPLET>
</CENTER>
</BODY>
</HTML>