Hi all
I need to draw sth to a Panel in an action, for instance
Graphics g = palCanvas.getGraphics();
g.setColor(Color.cyan);
g.fillPolygon(p);
Yes, the polygon is drawn, but after I update any control in the same form
or resize the window, the polygon disappears.
Can someone tell me how can I keep it?
Thanks!

Signature
Best Regards!
Hong.
---------------------------
Image Processing and Watermark components for .NET
http://www.ImageComponent.NET
Personal Entertainment Shareware and Freeware
http://www.angGoGo.com
Andrew Thompson - 20 Feb 2007 22:35 GMT
...
> I need to draw sth to a Panel in an action, for instance
>
> Graphics g = palCanvas.getGraphics();
This is the wrong way to approach
custom painting. It hould be done
on the Graphics object supplied to
paint()/paintComponent().
See,
<http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html>
for further details.
Andrew T.
Sowen Zhang - 20 Feb 2007 22:39 GMT
good reference, thanks a lot!

Signature
Best Regards!
Hong.
> ...
>> I need to draw sth to a Panel in an action, for instance
[quoted text clipped - 11 lines]
>
> Andrew T.