sorry for the probably dumb question,
but I'm new to java: I have a small example
that draws a rect in a paint method of
the canvas.
based on an event I redraw the rect with a
different color (with a call to fillRect).
The problem is that if I put the window in
background and then get it in forground, I
see the change, otherwise nothing appens!
Seem I'm missing a update call.
By the way, if I call the sequence
canvas.setVisible(false);
canvas.setVisible(true);
it works, but I do not want to redraw all the
canvas, just the rect, to avoid flickering.
thanks
G.
Roedy Green - 02 Nov 2005 11:56 GMT
>it works, but I do not want to redraw all the
>canvas, just the rect, to avoid flickering.
I don't see how anyone will be able diagnose problems without seeing
the code.
to repaint just a small part of the drawing, use a repaint with a
clipregion.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Thomas Hawtin - 02 Nov 2005 12:10 GMT
> The problem is that if I put the window in
> background and then get it in forground, I
> see the change, otherwise nothing appens!
> Seem I'm missing a update call.
And if you drag a window over the top, only the are that has been
covered is redrawn?
> By the way, if I call the sequence
> canvas.setVisible(false);
> canvas.setVisible(true);
> it works, but I do not want to redraw all the
> canvas, just the rect, to avoid flickering.
You need to tell the UI toolkit that the rectangle is 'damaged'. Call
Component.repaint with the bounds of the rectangle in the component's
coordinates.
http://download.java.net/jdk6/docs/api/java/awt/Component.html#repaint(int,
int, int, int)
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
tratrillo@yahoo.it - 02 Nov 2005 14:29 GMT
thank you very much: it was the missing repaint!
G.
Giorgio Schiavon - 02 Nov 2005 16:14 GMT
Hi,
I'm here again: the repaint works correctly
using jdk, but using kaffe, what I get is...
only the repaint og the modified rectangle :-(
That is the window is cleared, and then,
only the rect indicated in repaint is repainted.
Any idea why kaffe clear all the windows?
thanks
G.
Roedy Green - 03 Nov 2005 08:18 GMT
>Any idea why kaffe clear all the windows?
For a list of the usual mistakes see
http://mindprod.com/jgloss/paint.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.