The problem is this line:-

    >    g2d.setTransform(new AffineTransform());

in your code.

Swing specifies a translation on its graphics during repainting
of damaged areas.

By using "setTransform()" you just completely over-rode that
and now Swing will repair the wrong area.

you can translate, rotate etc .. but do not use setTransform()

-phil.

> X-Accept-Language: en
> Date: Wed, 6 Oct 1999 11:01:45 -0700
> From: Satish Annapureddy <[EMAIL PROTECTED]>
> Subject: [JAVA2D] help..repaint problem..
> To: [EMAIL PROTECTED]
>
> Hi,
>
> I am new to Java2D and am wondering if there are any
> issues with using Graphics2D with Swing  components.
>
> In the example code attached below,
> I have a JPanel whose paintComponent() method is overridden
> to use Graphics2D  to just draw a rectangle and a piece of text.
> When the window gets obscured and then exposed, I see some artifacts.
>
> However, if I use AWT Canvas instead of JPanel, the repainting works
> as expected.
>
> Also, I noticed that the Java2D demos override paint() method
> on DemoSurface
> which is a subclass of JPanel. Shouldn't they be overriding
> paintComponent()
> instead?
>
> I am using Blackdown's Linux port for Java version: 1.2 on Intel
> platform.
>
> Thanks,
> Satish.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to