Home E-Books Special Effects and Game Development in Java The Applet LoadImage

Special Effects and Game Development in Java(TM) - The Applet LoadImage

 

 

import java.applet.*;

import java.awt.*;



public class loadimage extends Applet {



public Image logo;



public void init()

{

    //Load the image "logo.jpg".

    logo=getImage(getDocumentBase(),"logo.jpg");

}



public void paint(Graphics g)

{

    //Draw the image with drawImage()

    g.drawImage(logo,0,0,this);

}



}