<Swing Dev> JPanel/Canvas refresh problem
Asier Aranbarri Beldarrain
aranbarriv at gmail.com
Mon Jan 3 09:02:51 UTC 2011
First of all, hi to all, this is my first post in this mailing list and I
just registered because of a problem i'm having with Swing.
Well, I have a Panel inside a Frame which consists of a Canvas that I need
to update in real time. Shortly, when you click on an option a different
image must appear.
I have no problems on displaying the image, but when the user clicks another
option, the old image doesn't dissappear, so the new one shows above the old
one. I'm trying repaint, validate, removeAll, etc but nothing seems to
work.
This is the code of the paintComponent() method on the Canvas class:
public void paintComponent(Graphics g){
super.paintComponents(g);
this.removeAll();
this.repaint();
(...) painting method (...)
...
}
Any suggestions? Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20110103/3281e41f/attachment.html>
More information about the swing-dev
mailing list