code: public void removeOverlay(Overlay overlay) {
  		if (overlay==null) throw new NullPointerException();
  		for (Component c: layeredPane.getComponents()) {
  			if (c instanceof OverlayComponent && ((OverlayComponent)c).overlay==overlay) {
  				overlay.removeOverlayComponent((OverlayComponent)c);
  				layeredPane.remove(c);
  				layeredPane.revalidate();
  				layeredPane.repaint();
  				return;
  			}
  		}
  		throw new IllegalArgumentException("Overlay not part of this viewer");
  	}
docs: Removes an overlay from the image viewer.
  @param overlay the overlay to remove
  @throws IllegalArgumentException if the overlay is not in the image viewer