Re: Rubber Band Box Over Tiff

From: Michael Borgwardt (
Date: 12/30/03

Date: Tue, 30 Dec 2003 19:39:44 +0100

Mike wrote:

> I am trying to create a rubber band box over a tiff image. I am
> currently using a tiledimage and also using getGraphics(). I can get
> the rectangle to be drawn with the mouse, but I cannot get the
> previous lines to erase, so eventually the screen will all turn black
> if I keep moving the mouse around. I can redraw the lines in
> white.... but how do I redraw them with the actual image?

Assuming that you're using Swing:
Don't draw the box directly on the image, draw it on an otherwise
transparent component on top, i.e. use a JLayeredPane or (if
the layout is simple enough) the GlassPane of the JFrame.