Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to avoid flickering when replacing a panel?  RSS feed

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Container that contains a Panel, panelA.

I am simply trying to replace panelA with panelB, but when I run the app, you see (very quickly) panelA being removed, then a grey box, then panelB being added = a lot of flicker.

Can anyone post any code that will replace a panel a bit more smoothly?
[ July 20, 2007: Message edited by: James Hodgkiss ]
 
Brian Cole
Author
Ranch Hand
Posts: 949
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by James Hodgkiss:
I have a Container that contains a Panel, panelA.

I am simply trying to replace panelA with panelB, but when I run the app, you see (very quickly) panelA being removed, then a grey box, then panelB being added = a lot of flicker.


Have you tried yourContainer.setDoubleBuffered(true)? It may or may not help, depending on the details. (Use an intervening JPanel if your container isn't a Swing container.)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!