本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}