/** Take a screenshot and save it using the current time as the file name. */ public static void takeScreenshot() { Date now = new Date(); SimpleDateFormat sdt = new SimpleDateFormat("yyyy.MM.dd-HH.mm.ss.SSS"); String filename = "data\\screenshot_" + sdt.format(now) + ".png"; PGraphics pg; pg = instance.createGraphics(instance.width, instance.height, P3D); pg.beginDraw(); instance.draw(); TouchClient.draw(); PromptManager.draw(); pg.endDraw(); if (pg.save(filename)) LOGGER.info("Screenshot saved: " + filename); else LOGGER.error("Failed to save screenshot."); }
/** * Load the GUI from a file. * * @see SimpleMarshaller#unmarshallGui(Application, File) */ public static void loadGUI() { LOGGER.info("Loading GUI from file: " + Settings.dataFolder + Settings.guiFile); try { SimpleMarshaller.unmarshallGui(instance, new File(Settings.dataFolder + Settings.guiFile)); } catch (Exception e) { LOGGER.fatal("Failed to load GUI. " + e.getLocalizedMessage()); System.exit(1); } if (backgroundImage != null && backgroundImage.length() > 0) { bg = instance.loadImage(Settings.dataFolder + backgroundImage); if (bg == null) LOGGER.error("Failed to load image: " + Settings.dataFolder + backgroundImage); } // Create default canvas (in case it is not specified in the layout file setCanvas(new Canvas((instance.width - 800) / 2, (instance.height - 600) / 2, 800, 600, 255)); // Create control buttons makeControlPanel(topDrawer.getContainer()); }
/** Close the application. */ public static void closeApplication() { LOGGER.info("Application closing."); TTSManager.dispose(); instance.exit(); }