This commit is contained in:
sfop
2017-03-16 17:02:11 +01:00
parent 7c8595f8ee
commit 44ebfb505c
2 changed files with 22 additions and 13 deletions

View File

@@ -2258,18 +2258,27 @@ public class ScreenPanel extends Panel {
private void buttonGrabBackgroundActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGrabBackgroundActionPerformed
try {
if (camera instanceof Camtool) {
if ((camera!=null) && (camera instanceof Camtool)) {
if (SwingUtils.showOption(getTopLevel(), "Background", "Do you want to capture background now?", OptionType.YesNo) == OptionResult.Yes) {
boolean laserOn = getLaserState();
boolean rendering = (!camera.isClosed());
if (rendering){
camera.close();
}
if (laserOn) {
setLaserState(false);
}
try {
((Camtool) camera).grabBackground(null, 5);
try{
System.out.println("Grabbing background for: " + cameraName);
((Camtool) camera).grabBackground(cameraName, 5);
} finally {
if (laserOn) {
setLaserState(true);
}
if (rendering){
comboCamerasActionPerformed(null);
}
updateStop();
}
SwingUtils.showMessage(getTopLevel(), "Success", "Success capturing background", 5000);
}