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.

Recommended Answers

All 2 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.