Lightweight Components not repainting after recent Classpath merge

Roman Kennke roman@kennke.org
Tue Feb 7 16:15:00 GMT 2006


Hi Scott,

> The problem appears to be in the Classpath code:
> gnu.java.awt.peer.GLightweightPeer.repaint needs to do what
> java.awt.Component.repaint used to do.  Something like:
> 
>   public void repaint(long tm, int x, int y, int width, int height)
>   {
>     Component p = comp.getParent ();
>     if (p != null)
>       p.repaint(0, x + comp.getX(), y + comp.getY(), width, height);
>   }

That doesn't make much sense, since the Component.repaint() calls into
the peer repaint(). While it would probably work (since you call repaint
on the parent and this eventually bubbles up to the toplevel window), it
is not really good. The right thing to do IMO would be to send an UPDATE
event to the event queue, something like what is done in Classpath's
GtkComponentPeer seems more correct. This eventually triggers a call to
update() (and thus paint() ) on your component which will have the
desired effect.

Cheers, Roman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
URL: <http://gcc.gnu.org/pipermail/java/attachments/20060207/423ec4b3/attachment.sig>


More information about the Java mailing list