dimtimer.java

来自「这是一个分布式通信程序框架源程序」· Java 代码 · 共 42 行

JAVA
42
字号
package dim;

public class DimTimer implements DimTimerHandler
{

	long id;
	public DimTimer(int secs)
	{
		start(secs);
	}
	public DimTimer()
	{
	}

	public static native long start(DimTimer theTimer, int secs);
	public static native int stop(long id);
	
	public void start(int secs)
	{
		id = start(this, secs);
	}
	
	public int stop()
	{
		return stop(id);
	}
	
	public static void sleep(int secs)
	{
  		try
        {
			Thread/*.currentThread()*/.sleep(secs*1000);
        }
        catch (Exception e) {}
	}
	public void timerHandler() {};
}

interface DimTimerHandler
{
	void timerHandler();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?