Java swing: Remanence when removing a heavyweight jogl component to add a lightweight component at the same place -


in swing application, when remove jogl glcanvas main component add jpanel @ same place, there display glitches: during time when old component has been removed , before new 1 has been added, remanent images of popup menus have been displayed before on top of glcanvas visible on background of main component.

how can avoid this?

when adding/removing components visible gui code should like:

panel.remove(...); panel.add(...); panel.revalidate(); panel.repaint(); 

also, the code should execute on event dispatch thread. if code executed within listener on edt. if code executed outside of listener need use swingworker or swingutilities.invokelater().


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -