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

📄 workerloader.java

📁 一个用于排队系统仿真的开源软件,有非常形象的图象仿真过程!
💻 JAVA
字号:
/**
 * 
 */
package jmt.gui.jwat.input;

import java.lang.reflect.InvocationTargetException;

import javax.swing.SwingUtilities;

import jmt.gui.jwat.SwingWorker;



/**
 * @author Maevar
 *
 */
public abstract class WorkerLoader extends SwingWorker {

	private ProgressShow viewer;
	
	/**
	 * 
	 */
	public WorkerLoader(ProgressShow prg) {
		super();
		viewer=prg;
	}
	
	protected void updateInfos(final int value,final String txt,boolean waitShow)
	{
		Runnable r=new Runnable(){
			public void run() {
				viewer.eventUpdate(value,txt);
			}
		};
		if(waitShow){
			try {
				SwingUtilities.invokeAndWait(r);
			} catch (InterruptedException e) {
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				e.printStackTrace();
			}
		}
		else{
			SwingUtilities.invokeLater(r);
		}		
	}
	
	protected boolean isCanceled()
	{
		return viewer.isCanceled();
	}
	
	protected void initShow(final int maxValue) throws InterruptedException, InvocationTargetException
	{
		Runnable r=new Runnable(){
			public void run() {
				viewer.initShow(maxValue);
			}
		};

		SwingUtilities.invokeAndWait(r);
	}
	
	protected void closeView()
	{
		Runnable r=new Runnable(){
			public void run() {
				viewer.closeView();
			}
		};
		
		SwingUtilities.invokeLater(r);
		
	}

	/* (non-Javadoc)
	 * @see jmt.jwat.Utility.SwingWorker#construct()
	 */
	public abstract Object construct();
	
	/* (non-Javadoc)
	 * @see jmt.jwat.Utility.SwingWorker#finished()
	 */
	public abstract void finished(); 
}

⌨️ 快捷键说明

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