JTabbedPane swing update error
I have 2 JPanels in a JTabbedPane and when update(g) is called on a panel inside the first panel (Its an animation) even if the second panel is the selected panel(i.e the one you can see) the updated panel appears on the screen. Why is this and how can i circumvent this behaviour? The update() method of JComponent "doesn't clear the background," so you may need to do that explicitly. Typical examples of JTabbedPane don't usually require using update() . Perhaps an sscce showing your usage might help. Addendum 1: It's not clear why you are calling update() . Below is a simple animation that