import java.awt.Graphics; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; public class MotionDetectorCam extends WebCam{ int threshold = 25; public static void main(String[] arglimentos){ MotionDetectorCam mdc = new MotionDetectorCam(); } public void newFrame(){ float percentageChange = getAmountOfChange(threshold); //put("change" + percentageChange); if (percentageChange > 0.3f){ ps.getImage(freezeFrame); } super.newFrame(); } public void keyReleased(KeyEvent e) { String whichKey = KeyEvent.getKeyText(e.getKeyCode()); put ( whichKey); if (whichKey.equals("Up")) { threshold++; } else if (whichKey.equals("Down")) { threshold--; } else{ super.keyReleased(e); } } }