PDA

View Full Version : Java coding problem


JavaTest?
02-03-2003, 09:25 PM
Is there any way to set the background of an applet to an image file like a .bmp image?

Josh Campbell
02-04-2003, 12:01 AM
.bmp bitmaps should not be used in Java. JPEG and GIF are the standards. You could simply draw the image in the paint method of your applet or another component.

public void paint(Graphics g)
{
super.paint(g);
Image im = getImage(getDocumentBase(), "myfile.gif");
g.drawImage(im, 0, 0, getSize().width, getSize().height, this);
}

JavaTest?
02-05-2003, 07:50 PM
thanks