code: public void stop() {
  
  		if (!started.compareAndSet(true, false)) {
  			return;
  		}
  
  		webcam.removeWebcamListener(this);
  
  		LOG.debug("Stopping panel rendering and closing attached webcam");
  
  		try {
  			updater.stop();
  		} catch (InterruptedException e) {
  			throw new RuntimeException(e);
  		}
  
  		image = null;
  
  		final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {
  
  			@Override
  			protected Void doInBackground() throws Exception {
  
  				try {
  					if (webcam.isOpen()) {
  						errored = !webcam.close();
  					}
  				} catch (WebcamException e) {
  					errored = true;
  					throw e;
  				} finally {
  					repaintPanel();
  				}
  
  				return null;
  			}
  		};
  		worker.execute();
  	}
docs: Stop rendering and close webcam.