Hi
I assume you are overriding JComponent.paintComponent( Graphics g ), and
not JComponent.paint( Graphics g )?
Best Regards
Nicholas
> 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
===========================================================================
Nicholas Wright Imperial Software Technology Senior Software Engineer
---------------------------------------------------------------------------
Email : [EMAIL PROTECTED] or [EMAIL PROTECTED]
Berkshire House 120 Hawthorne Ave, #101
252 Kings Road Palo Alto
Reading RG1 4HP United Kingdom California 94301 USA
Tel: +44 118 958 7055 Tel: 650 688 0200
FAX: +44 118 958 9005 FAX: 650 688 1054
===========================================================================
****** VISAJ AT http://www.ist.co.uk/visaj ******
===========================================================================
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing