当前位置: 首页>>代码示例>>Java>>正文


Java Loader类代码示例

本文整理汇总了Java中com.cburch.logisim.file.Loader的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Loader类属于com.cburch.logisim.file包,在下文中一共展示了Loader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createEmptyFile

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private static LogisimFile createEmptyFile(Loader loader) {
	InputStream templReader = AppPreferences.getEmptyTemplate().createStream();
	LogisimFile file;
	try {
		file = loader.openLogisimFile(templReader);
	} catch (Throwable t) {
		file = LogisimFile.createNew(loader);
		file.addCircuit(new Circuit("main"));
	} finally {
		try {
			templReader.close();
		} catch (IOException e) {
		}
	}
	return file;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:17,代码来源:ProjectActions.java

示例2: doOpen

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static void doOpen(Component parent, Project baseProject) {
	JFileChooser chooser;
	if (baseProject != null) {
		Loader oldLoader = baseProject.getLogisimFile().getLoader();
		chooser = oldLoader.createChooser();
		if (oldLoader.getMainFile() != null) {
			chooser.setSelectedFile(oldLoader.getMainFile());
		}
	} else {
		chooser = JFileChoosers.create();
	}
	chooser.setFileFilter(Loader.LOGISIM_FILTER);

	int returnVal = chooser.showOpenDialog(parent);
	if (returnVal != JFileChooser.APPROVE_OPTION)
		return;
	File selected = chooser.getSelectedFile();
	if (selected != null) {
		doOpen(parent, baseProject, selected);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:22,代码来源:ProjectActions.java

示例3: createEmptyFile

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private static LogisimFile createEmptyFile(Loader loader,Project proj) {
	InputStream templReader = AppPreferences.getEmptyTemplate()
			.createStream();
	LogisimFile file;
	try {
		file = loader.openLogisimFile(templReader);
	} catch (Exception t) {
		file = LogisimFile.createNew(loader,proj);
		file.addCircuit(new Circuit("main", file,proj));
	} finally {
		try {
			templReader.close();
		} catch (IOException e) {
		}
	}
	return file;
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:18,代码来源:ProjectActions.java

示例4: doOpen

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static boolean doOpen(Component parent, Project baseProject) {
	JFileChooser chooser;
	if (baseProject != null) {
		Loader oldLoader = baseProject.getLogisimFile().getLoader();
		chooser = oldLoader.createChooser();
		if (oldLoader.getMainFile() != null) {
			chooser.setSelectedFile(oldLoader.getMainFile());
		}
	} else {
		chooser = JFileChoosers.create();
	}
	chooser.setFileFilter(Loader.LOGISIM_FILTER);
	chooser.setDialogTitle(Strings.get("FileOpenItem"));

	int returnVal = chooser.showOpenDialog(parent);
	if (returnVal != JFileChooser.APPROVE_OPTION)
		return false;
	File selected = chooser.getSelectedFile();
	if (selected != null) {
		doOpen(parent, baseProject, selected);
	}
	return true;
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:24,代码来源:ProjectActions.java

示例5: doOpen

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static void doOpen(Component parent, Project baseProject) {
	JFileChooser chooser;
	if (baseProject != null) {
		Loader oldLoader = baseProject.getLogisimFile().getLoader();
		chooser = oldLoader.createChooser();
		if (oldLoader.getMainFile() != null) {
			chooser.setSelectedFile(oldLoader.getMainFile());
		}
	} else {
		chooser = JFileChoosers.create();
	}
	chooser.setFileFilter(Loader.LOGISIM_FILTER);
				
	int returnVal = chooser.showOpenDialog(parent);
	if (returnVal != JFileChooser.APPROVE_OPTION) return;
	File selected = chooser.getSelectedFile();
	if (selected != null) {
		doOpen(parent, baseProject, selected);
	}
}
 
开发者ID:franciscaconcha,项目名称:ProyectoLogisim,代码行数:21,代码来源:ProjectActions.java

示例6: completeProject

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private static Project completeProject(SplashScreen monitor, Loader loader, LogisimFile file, boolean isStartup) {
	if (monitor != null)
		monitor.setProgress(SplashScreen.PROJECT_CREATE);
	Project ret = new Project(file);

	if (monitor != null)
		monitor.setProgress(SplashScreen.FRAME_CREATE);
	SwingUtilities.invokeLater(new CreateFrame(loader, ret, isStartup));
	return ret;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:11,代码来源:ProjectActions.java

示例7: doSave

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static boolean doSave(Project proj) {
	Loader loader = proj.getLogisimFile().getLoader();
	File f = loader.getMainFile();
	if (f == null)
		return doSaveAs(proj, true);
	else
		return doSave(proj, f);
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:9,代码来源:ProjectActions.java

示例8: findProjectFor

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static Project findProjectFor(File query) {
	for (Project proj : openProjects) {
		Loader loader = proj.getLogisimFile().getLoader();
		if (loader == null)
			continue;
		File f = loader.getMainFile();
		if (query.equals(f))
			return proj;
	}
	return null;
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:12,代码来源:Projects.java

示例9: loadTemplate

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private void loadTemplate(Loader loader, File templFile, boolean templEmpty) {
	if (showSplash)
		monitor.setProgress(SplashScreen.TEMPLATE_OPEN);
	if (templFile != null) {
		AppPreferences.setTemplateFile(templFile);
		AppPreferences.setTemplateType(AppPreferences.TEMPLATE_CUSTOM);
	} else if (templEmpty) {
		AppPreferences.setTemplateType(AppPreferences.TEMPLATE_EMPTY);
	} else if (templPlain) {
		AppPreferences.setTemplateType(AppPreferences.TEMPLATE_PLAIN);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:13,代码来源:Startup.java

示例10: doLoadLogisimLibrary

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static void doLoadLogisimLibrary(Project proj) {
	Loader loader = proj.getLogisimFile().getLoader();
	JFileChooser chooser = loader.createChooser();
	chooser.setDialogTitle(Strings.get("loadLogisimDialogTitle"));
	chooser.setFileFilter(Loader.LOGISIM_FILTER);
	int check = chooser.showOpenDialog(proj.getFrame());
	if (check == JFileChooser.APPROVE_OPTION) {
		File f = chooser.getSelectedFile();
		Library lib = loader.loadLogisimLibrary(f);
		if (lib != null) {
			proj.doAction(LogisimFileActions.loadLibrary(lib));
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:15,代码来源:ProjectLibraryActions.java

示例11: actionPerformed

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
	Object src = e.getSource();
	if (src == unload) {
		ProjectLibraryActions.doUnloadLibrary(proj, lib);
	} else if (src == reload) {
		Loader loader = proj.getLogisimFile().getLoader();
		loader.reload((LoadedLibrary) lib);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:11,代码来源:Popups.java

示例12: completeProject

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
private static Project completeProject(SplashScreen monitor, Loader loader,
		LogisimFile file, boolean isStartup) {
	if (monitor != null)
		monitor.setProgress(SplashScreen.PROJECT_CREATE);
	Project ret = new Project(file);
	if (monitor != null)
		monitor.setProgress(SplashScreen.FRAME_CREATE);
	SwingUtilities.invokeLater(new CreateFrame(loader, ret, isStartup));
	updatecircs(file,ret);
	return ret;
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:12,代码来源:ProjectActions.java

示例13: doOpenNoWindow

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static Project doOpenNoWindow(SplashScreen monitor, File source)
		throws LoadFailedException {
	Loader loader = new Loader(monitor);
	LogisimFile file = loader.openLogisimFile(source);
	Project ret = new Project(file);
	updatecircs(file,ret);
	return ret;
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:9,代码来源:ProjectActions.java

示例14: doSave

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static boolean doSave(Project proj) {
	Loader loader = proj.getLogisimFile().getLoader();
	File f = loader.getMainFile();
	if (f == null)
		return doSaveAs(proj);
	else
		return doSave(proj, f);
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:9,代码来源:ProjectActions.java

示例15: findProjectFor

import com.cburch.logisim.file.Loader; //导入依赖的package包/类
public static Project findProjectFor(File query) {
	for (Project proj : openProjects) {
		Loader loader = proj.getLogisimFile().getLoader();
		if (loader == null) {
			continue;
		}
		File f = loader.getMainFile();
		if (query.equals(f)) {
			return proj;
		}
	}
	return null;
}
 
开发者ID:reds-heig,项目名称:logisim-evolution,代码行数:14,代码来源:Projects.java


注:本文中的com.cburch.logisim.file.Loader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。