private void updateBuffer() { // As explained under 'WORKSPACE' BUFFER EXPLANATION, the static children are drawn to the // 'workspace' buffer // as the Workspace takes up the entire screen, this can be done just by getting the screen // buffer workspace = VagueWindow.getWindow().getBuffer(); }
@Override public void keyDown(KeyEvent e) { if (activeIndex != -1) { // If there is an active tool (activeIndex > -1), then it's key down method should // be called if (Controls.bank.status(Controls.WORKSPACE_TAKE_SCREENSHOT)) { activeChild.fill( new SaveFile("Save screenshot:", VagueWindow.getWindow().getBuffer(), activeChild)); } else if (Controls.bank.status(Controls.WORKSPACE_SAVE_IMAGE)) { BufferedImage save = Context.getContext().renderAsSave(); if (!SaveFile.save(save, lastSavePath.toString())) { lastSavePath = new StringBuilder(); // Clear save path activeChild.fill(new SaveFile("Save image:", save, activeChild, lastSavePath)); } } else if (Controls.bank.status(Controls.WORKSPACE_SAVE_AS)) { System.err.println("save as!"); lastSavePath = new StringBuilder(); // Clear save path activeChild.fill( new SaveFile( "Save image:", Context.getContext().renderAsSave(), activeChild, lastSavePath)); } else { activeChild.keyDown(e); } } }