Java Applets

Applet is my favorite topic. Here I want to explain you about applet.

Definition of Applet :

It is program that can be embedded in HTML documents. It is useful to make website entertaining and more attractive. We can include chat feature using java applet. It runs in the browsers like internet explorer and mozilla, these browsers supports java features.

It can be downloaded here free. http://java.sun.com/j2se/.


A simple program how to display image file using Java applet :

import java.applet.*;

import java.awt.*;



public class appletImage extends Applet{


Image img;

MediaTracker tr;

public void paint(Graphics g) {

tr = new MediaTracker(this);


img = getImage(getCodeBase(), "myimage.gif");

tr.addImage(img,0);


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

}

}


1 comments:

Mark Smith said...

very informative site.... keep it up...