import java.applet.Applet; import java.awt.*; class Js_3_1 extends Applet{ public void paint(Graphics g){ g.drawString("はじめてのアプレット",0,20); } } |
appletviewer Js_3_1.java |
<html> <head> <title>はじめてのアプレット</title> </head> <body> <applet code="Js_3_1.class" width="400" height="400"></applet> </body> </html> |
/* <applet code="Js_3_1.class" width="400" height="400"></applet> */ import java.applet.Applet; import java.awt.*; : : |
Go to Index
import java.applet.Applet; import java.awt.*; class Js_3_2 extends Applet{ String str; public void init(){ str+="アプレット開始。"; } public void start(){ str+="実行。"; } public void stop(){ str+="中断。"; } public void paint(Graphics g){ g.drawString(str,0,20); } } |
Go to Index