public
void
start()
{
if
(M_pointThread==
null
)
//如果线程尚未产生
{
M_pointThread=
new
Thread(
this
);
//则创建一个新线程
M_pointThread.start();
//启动该线程
}
}
//在当前页面关闭或转向其他 Web 页面时,调用 stop()方法,以释放系统资源
public
void
stop()
{
if
(M_pointThread!=
null
)
//如果线程尚在运行
{
M_pointThread.stop();
//停止该线程
M_pointThread=
null
;
//释放线程所占资源
}
}
3
.编写线程运行的代码:
public
void
run()
{
M_graphics=getGraphics();
M_graphics.setXORMode(Color.white);
//
“
”
采用异或方法绘制 十字 游标
while
(
true
)
{
try
{
if
(MouseMove==
true
)
//侦测到鼠标的移动后,执行以下代码