由网友(可爱中带点骚)分享简介:您好。我希望在Java中的功能,可自动调用。HI.I want a function in java that automatically called.例如文,我们使用时间类像吹for example wen we use Time class like blew在 actionperformerd()函...
您好。 我希望在Java中的功能,可自动调用。
HI. I want a function in java that automatically called.
例如文,我们使用时间
类像吹
for example wen we use Time
class like blew
在 actionperformerd()
函数调用每一个1秒。
the actionperformerd()
function call every 1second.
Timer time = new Time(10,this);
.
.
.
public void actionperformed()
{
timer.run;
//i want move a pic every 1millisecond.
}
我的问题是,定时器
类只接受int值,它的最小
为1秒,我想调用的actionPerformed每隔1毫秒。
my problem is that Timer
class only accept int value and it's minimum
value is 1 second and i want call actionperformed every 1 millisecond.
推荐答案
Java的Timer在接受参数毫秒。所以,你可以做
Java Timer accepts milliseconds in parameters. So you can do
new Timer().schedule(new TimerTask() {
public void run() {
// do stuff
}
}, 1, 1);
不过,有实时功能与毫秒precision您可能需要切换到C。
But to have real-time functionality with milliseconds precision you may need to switch to C.
相关推荐
最新文章