有关定时器的问题!在线等待! 弄个线程,程序开始的时候让它运行,运行起来就sleep7分钟,醒了就通知,呵呵。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 thread.sleep(7000);//soundthread.sleep(1000);//sound精确到毫秒! import java.awt.*;import java.awt.event.*;import java.applet.*;public class applet7 extends Applet implements Runnable{ Image memoryimage; Graphics memorygraphics; Thread doublebufferthread; boolean animateFlag = true; long t=System.currentTimeMillis(); double d; //Initialize the applet public void init() { memoryimage = createImage(100,100); memorygraphics = memoryimage.getGraphics(); } public void start() { doublebufferthread = new Thread(this); doublebufferthread.start(); } public void stop() { animateFlag = false; } public void run() { try { while(true) { Thread.sleep(100); long t1=System.currentTimeMillis(); d=(double)(t1-t)/1000; repaint(); if(d>=10)//这里设置到时时间,这里为10秒 break; } this.getToolkit().beep();//这里发出提示的声音 javax.swing.JOptionPane.showMessageDialog(this.getParent(),"时间到!"); } catch(InterruptedException e) { } } public void paint(Graphics g) { g.drawString(String.valueOf(d),100,100); }} netbeans 一个设置问题 有意思的数组问题 ant新手求助!The <javac> task doesn't support the "source" attribute 经理都搞不懂的问题,请教(附简单代码) 问一个菜鸟级的问题,高手们帮忙呀!! 发几篇swing中关于JTable中的运用-2 大大进来,看看这个段子你怎么写 请教一道SCJP模拟题 关于LIST中元素更换位置的问题~~~ java中怎样定义字符串/整型数组,并赋值? 如果在java中调试jdbc的程序? 一个关于线程的小问题
thread.sleep(7000);
//sound
thread.sleep(1000);
//sound精确到毫秒!
import java.awt.event.*;
import java.applet.*;public class applet7 extends Applet implements Runnable
{
Image memoryimage;
Graphics memorygraphics;
Thread doublebufferthread;
boolean animateFlag = true;
long t=System.currentTimeMillis();
double d;
//Initialize the applet
public void init()
{
memoryimage = createImage(100,100);
memorygraphics = memoryimage.getGraphics();
} public void start()
{
doublebufferthread = new Thread(this);
doublebufferthread.start();
} public void stop()
{
animateFlag = false;
} public void run()
{
try
{
while(true) {
Thread.sleep(100);
long t1=System.currentTimeMillis();
d=(double)(t1-t)/1000;
repaint();
if(d>=10)//这里设置到时时间,这里为10秒
break;
}
this.getToolkit().beep();//这里发出提示的声音
javax.swing.JOptionPane.showMessageDialog(this.getParent(),"时间到!");
}
catch(InterruptedException e)
{ }
} public void paint(Graphics g)
{
g.drawString(String.valueOf(d),100,100);
}
}