Hi,

I would like to draw lines that use XOR mode to erase themselves.   That
is, when the user presses the mouse key I want to establish the (x,y)
coordinates of that point as the "anchor" point, and as the user drags
the mouse, with each mouseDragged() call I want to XOR the line from the
anchor point to the previous mouseDragged() point and draw a new line
(still in XOR mode) from the anchor point to the current, new
mouseDragged() reported point.

What happens now is that when I get a mouseDragged() event call and end
its method code with a repaint() call the drawing area is cleared, so
the previous line (from anchor point to previous mouseDragged() reported
point) is erased by the JVM.   The end result being that in Swing I get
"rubber lines" without the need of using the g.setXORMode() call.

Can anyone show me how to stop that repaint() from clearing the drawing
area?   Back in AWT (Panel, not JPanel) days I could override update()
with a void body to keep the JVM from clearing the drawing area.   But,
update() is not recognizable in subclasses of JComponent, as far as I
can see.    How do we do in Swing what we were able to do in subclasses
of Component with the update() call?

Any help would be greatly appreciated!!!  (I would like to use this for
a Java class I am teaching, using Swing, not AWT.)

Bill

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to