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


Java Screen.closePrompt方法代码示例

本文整理汇总了Java中org.sikuli.script.Screen.closePrompt方法的典型用法代码示例。如果您正苦于以下问题:Java Screen.closePrompt方法的具体用法?Java Screen.closePrompt怎么用?Java Screen.closePrompt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sikuli.script.Screen的用法示例。


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

示例1: update

import org.sikuli.script.Screen; //导入方法依赖的package包/类
@Override
public void update(EventSubject s) {
	SneakyExceptionHandler.removeTemporaryUncaughtExceptionHandler();
	Screen.closePrompt();
	if (selectionErrorOccured ) {
		Screen.resetPrompt((OverlayCapturePrompt) s);
		return;
	}
	// This code is run in AWT thread. Using atomic reference to pass ScreenImage later to
	// JavaFX thread.
	AtomicReference<ScreenImage> atomicScreenImage = new AtomicReference<>(null);
	// FIXME: a lot of stuff here is "Internal use" and "deprecated" in SikuliX library. Add
	// unit tests to be able to notice any related problems before each release. Or some day the
	// users might get angry.
	if (s != null) {
		OverlayCapturePrompt prompt = (OverlayCapturePrompt) s;
		atomicScreenImage.set(prompt.getSelection());
	}
	Platform.runLater(() -> {
		ScreenImage screenImage = atomicScreenImage.get();
		if (screenImage != null) { // Image selected, selection wasn't cancelled.
			setX(screenImage.x);
			setY(screenImage.y);
			setW(screenImage.w);
			setH(screenImage.h);
		}
	});
	Screen.resetPrompt((OverlayCapturePrompt) s);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:30,代码来源:CoordinatesController.java

示例2: update

import org.sikuli.script.Screen; //导入方法依赖的package包/类
@Override
public void update(EventSubject s) {
	SneakyExceptionHandler.removeTemporaryUncaughtExceptionHandler();
	Screen.closePrompt();
	if (selectionErrorOccured) {
		Screen.resetPrompt((OverlayCapturePrompt) s);
		return;
	}
	// This code is run in AWT thread. Using atomic reference to pass ScreenImage later to
	// JavaFX thread.
	AtomicReference<ScreenImage> atomicScreenImage = new AtomicReference<>(null);
	// FIXME: a lot of stuff here is "Internal use" and "deprecated" in SikuliX library. Add
	// unit tests to be able to notice any related problems before each release. Or some day the
	// users might get angry.
	if (s != null) {
		OverlayCapturePrompt prompt = (OverlayCapturePrompt) s;
		atomicScreenImage.set(prompt.getSelection());
	}
	Platform.runLater(() -> {
		ScreenImage screenImage = atomicScreenImage.get();
		if (screenImage != null) { // Image selected, selection wasn't cancelled.
			BufferedImage bi = screenImage.getImage();
			File file = GUIUtil.showJavaSingleFileChooser(
					"Choose where to save captured Target image",
					"Portable Network Graphics image file", true, root.getScene().getWindow(),
					allowedExtensions);
			if (file != null) { // File was chosen.
				try {
					ImageIO.write(bi, "png", file);
					// Write was successful if there were no exceptions, let's modify controls.
					targetTextField.setText(file.getAbsolutePath());
					updateViewBasedOnTargetImagePath(file.getAbsolutePath());
				} catch (Exception e) {
					Alert alert = new Alert(AlertType.ERROR);
					GUIUtil.cutifyAlert(alert);
					alert.setTitle("Can't save Target image file");
					alert.setHeaderText("Dear user, StreamSis can't save Target image file.");
					if ("IOException".equals(e.getClass().getSimpleName())) {
						alert.setContentText("You probably don't have system rights to write "
								+ "image file there.");
					} else {
						alert.setContentText("Image file can't be saved, because of "
								+ "IllegalArgumentException. It's one of the Seven Buggy Sins "
								+ "that a programmer can make.");
					}
					GUIUtil.showAlertInPrimaryStageCenter(alert);
				}
			}
		}
	});
	Screen.resetPrompt((OverlayCapturePrompt) s);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:53,代码来源:TargetImageWithActionsController.java

示例3: update

import org.sikuli.script.Screen; //导入方法依赖的package包/类
@Override
public void update(EventSubject s) {
	SneakyExceptionHandler.removeTemporaryUncaughtExceptionHandler();
	Screen.closePrompt();
	if (selectionErrorOccured) {
		Screen.resetPrompt((OverlayCapturePrompt) s);
		return;
	}
	// This code is run in AWT thread. Using atomic reference to pass ScreenImage later to
	// JavaFX thread.
	AtomicReference<ScreenImage> atomicScreenImage = new AtomicReference<>(null);
	// FIXME: a lot of stuff here is "Internal use" and "deprecated" in SikuliX library. Add
	// unit tests to be able to notice any related problems before each release. Or some day the
	// users might get angry.
	if (s != null) {
		OverlayCapturePrompt prompt = (OverlayCapturePrompt) s;
		atomicScreenImage.set(prompt.getSelection());
	}
	Platform.runLater(() -> {
		ScreenImage screenImage = atomicScreenImage.get();
		if (screenImage != null) { // Image selected, selection wasn't cancelled.
			BufferedImage bi = screenImage.getImage();
			File file = GUIUtil.showJavaSingleFileChooser(
					"Choose where to save captured Target image",
					"Portable Network Graphics image file", true, root.getScene().getWindow(),
					allowedExtensions);
			if (file != null) { // File was chosen.
				try {
					ImageIO.write(bi, "png", file);
					// Write was successful if there were no exceptions, let's modify controls.
					targetTextField.setText(file.getAbsolutePath());
					updateViewBasedOnTargetImagePath(file.getAbsolutePath());
					this.coordsController.setX(screenImage.x);
					this.coordsController.setY(screenImage.y);
					this.coordsController.setW(screenImage.w);
					this.coordsController.setH(screenImage.h);
				} catch (Exception e) {
					Alert alert = new Alert(AlertType.ERROR);
					GUIUtil.cutifyAlert(alert);
					alert.setTitle("Can't save Target image file");
					alert.setHeaderText("Dear user, StreamSis can't save Target image file.");
					if ("IOException".equals(e.getClass().getSimpleName())) {
						alert.setContentText("You probably don't have system rights to write "
								+ "image file there.");
					} else {
						alert.setContentText("Image file can't be saved, because of "
								+ "IllegalArgumentException. It's one of the Seven Buggy Sins "
								+ "that a programmer can make.");
					}
					GUIUtil.showAlertInPrimaryStageCenter(alert);
				}
			}
		}
	});
	Screen.resetPrompt((OverlayCapturePrompt) s);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:57,代码来源:RegionTargetCounterController.java

示例4: update

import org.sikuli.script.Screen; //导入方法依赖的package包/类
@Override
public void update(EventSubject s) {
	SneakyExceptionHandler.removeTemporaryUncaughtExceptionHandler();
	Screen.closePrompt();
	if (selectionErrorOccured) {
		Screen.resetPrompt((OverlayCapturePrompt) s);
		return;
	}
	// This code is run in AWT thread. Using atomic reference to pass ScreenImage later to
	// JavaFX thread.
	AtomicReference<ScreenImage> atomicScreenImage = new AtomicReference<>(null);
	// FIXME: a lot of stuff here is "Internal use" and "deprecated" in SikuliX library. Add
	// unit tests to be able to notice any related problems before each release. Or some day the
	// users might get angry.
	if (s != null) {
		OverlayCapturePrompt prompt = (OverlayCapturePrompt) s;
		atomicScreenImage.set(prompt.getSelection());
	}
	Platform.runLater(() -> {
		ScreenImage screenImage = atomicScreenImage.get();
		if (screenImage != null) { // Image selected, selection wasn't cancelled.
			BufferedImage bi = screenImage.getImage();
			File file = GUIUtil.showJavaSingleFileChooser(
					"Choose where to save captured Target image",
					"Portable Network Graphics image file", true, root.getScene().getWindow(),
					allowedExtensions);
			if (file != null) { // File was chosen.
				try {
					ImageIO.write(bi, "png", file);
				} catch (Exception e) {
					Alert alert = new Alert(AlertType.ERROR);
					GUIUtil.cutifyAlert(alert);
					alert.setTitle("Can't save Target image file");
					alert.setHeaderText("Dear user, StreamSis can't save Target image file.");
					if ("IOException".equals(e.getClass().getSimpleName())) {
						alert.setContentText("You probably don't have system rights to write "
								+ "image file there.");
					} else {
						alert.setContentText("Image file can't be saved, because of "
								+ "IllegalArgumentException. It's one of the Seven Buggy Sins "
								+ "that a programmer can make.");
					}
					GUIUtil.showAlertInPrimaryStageCenter(alert);
				}
			}
		}
	});
	Screen.resetPrompt((OverlayCapturePrompt) s);
}
 
开发者ID:ubershy,项目名称:StreamSis,代码行数:50,代码来源:MultiTargetRegionCheckerController.java


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