⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 applicationmonitor.java

📁 PIY(Program It Yourself)是一个基于Java的应用程序开发环境
💻 JAVA
字号:
package piy;

import java.util.Observer;

/**
* Monitors an application.  When the application wishes to terminate, this class will
* notify a specified observer.
* @author David Vivash
* @version 1.0, 20/4/01
*/
public class ApplicationMonitor implements Runnable 
{
	Application app = null;
	Observer o = null;

	public ApplicationMonitor(Application app, Observer o) {
		this.app = app;
		this.o = o;
	}
	
	public void run() {
		boolean running = true;
		while (running) {
			try {
				running = app.running;
				Thread.currentThread().sleep(100);
			} catch (InterruptedException e) { }
		}
		
		//Application wishes to terminate
		//notify observer
		o.update(null, null);
	}

}

⌨️ 快捷键说明

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