appletlifecircle.java
来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 48 行
JAVA
48 行
/**
*A applet life circle demostration program,pay more attention!
*2004.12.23. xhcprince
*/
import java.applet.Applet;
import java.awt.Graphics;
public class appletLifeCircle extends Applet
{
String s = "The ";
public void init()
{
s += "New "; //when init the applet!
System.out.println(s);
}
public void start()
{
s += "Applet "; //when the applet's inited or the applet window is activated from the minimized state!
System.out.println(s);
}
public void stop()
{
s += "Stops "; //when minimize the applet window!
System.out.println("Stops");
}
public void destroy()
{
s += "Here "; //when close the applet window!
System.out.println("Here");
}
public void paint(Graphics g)
{
g.drawRect(25,25,100,100);
s += "Draw "; //when the rectangle has been drawed
g.drawString(s,25,40);
}
}
/*
<applet code = "appletLifeCircle.class" width = 160 height = 160>
</applet>
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?