File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes repaint problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "repaint problem" Watch "repaint problem" New topic

repaint problem

sharingan reddy

Joined: Feb 14, 2010
Posts: 8
i want to add a panel taking radio button selected the panels are adding but the previous panel is not erasing even on repaint() on the parent panel.
how to resolve thatjavascript:emoticon('');
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10828

After you add/remove the panel, invoke revalidate() and repaint() on the parent panel

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
pete stein

Joined: Feb 23, 2007
Posts: 1561
I also wonder if a CardLayout would work for you. Are you swapping JPanels? If so, you may want to look into this.

Best of luck!
I agree. Here's the link:
subject: repaint problem
jQuery in Action, 3rd edition