Java program to display numbers from 1 to 10 on Applet such that each number will be displayed after a delay of 100 ms.

Write a JAVA program to implement a program to display numbers from 1 to 10 on Applet such that each number will be displayed after a delay of 100 ms.

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

<applet code="Numbers.class" width=300 height=300>
</applet> 
*/

public class Numbers extends Applet
{
	public void paint(Graphics g)
	{
	   try
	   {
		for(int i = 1; i <= 10; i ++)
		{
			g.drawString(String.valueOf(i), 100, 100 + (i * 15));
			Thread.sleep(100);
		}
	   }
	   catch(InterruptedException e)
	   {
		System.out.println(e);
	   }
	}
}

 

Rabins Sharma Lamichhane

Rabins Sharma Lamichhane is the owner of RabinsXP who is constantly working for increasing the Internet of Things (IoT) in Nepal. He also builds android apps and crafts beautiful websites. He is also working with various social services. The main aim of Lamichhane is to digitally empower the citizens of Nepal and make the world spiritually sound better both in terms of technology and personal development. Rabins is also the first initiator of Digital Nepal.

You may also like...

Leave a Reply

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