How to Display an Image in an Applet in Core Java

In this tutorial how to display an image in an Applet in Core Java is shown.

Code:

ImageDemo.java

/* <applet code=”ImageDemo.class” width=”1250″ height=”800″> </applet>*/

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

public class ImageDemo extends Applet
{
Image picture;
public void init()
{
picture=getImage(getDocumentBase(),”Desert.jpg”);
}

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

}

https://youtu.be/hgOCZpawj3c

Add a Comment

Your email address will not be published. Required fields are marked *