Aug 2, 2008

How To Insert An Image Into JAVA Applet

Sometimes we need to add an image or logo into JAVA applet. Here is how you can achieve the same. Program below illustrates this.

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


public class im extends Applet
{
Image img;

public void init()
{
img = getImage(getDocumentBase(), "ash.jpg");
}


public void paint(Graphics g)
{
g.drawImage(img,50,50,this);
}
}

No comments:

Post a Comment

Infolinks In Text Ads

Total Pageviews

Powered by Blogger.

Dont Forget To Follow Us

Blog Archive