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" ) ; }
Removes an overlay from the image viewer .