0

this is my java code that i'm experimenting with right now. trying to learn graphics.

import java.applet.*;
import java.awt.*;

public class game extends Applet
{
	Image dbz;
	
	public void init()
	{
		Font newFont = new Font("TimesRoman", Font.BOLD + Font.ITALIC, 50);
		setFont(newFont);
		dbz = getImage(getCodeBase(), "dbz.jpeg");
	}
	
	public void paint(Graphics g)
	{
		//Color red = new Color(255,0,0);
		//g.setColor(red);
		//g.drawString("hello world", 50, 50);
		g.drawImage(dbz,0,0,this);
	}
}

and i'm just using a regular html file to run it in. when i compile it i get no errors, but the image never shows. on line 12 i can type anything into the quotes and still get no errors, so i think that might be where the problem is.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ProgrammerAl
0

Only thing I can really think of is did you add it to something that can show it? My friend had this problem earlier today he just forgot to add.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.