Programming Tutorials

(追記) (追記ここまで)

Java program to display numbers from 1 to 10 on Applet

By: Paawan Chaudhary in Java Tutorials on 2012年09月19日 [フレーム]

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

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);
	 }
	}
}



(追記) (追記ここまで)


Add Comment

JavaScript must be enabled for certain features to work
* Required information
1000

Comments

No comments yet. Be the first!
(追記) (追記ここまで)
(追記) (追記ここまで)

AltStyle によって変換されたページ (->オリジナル) /