[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 146
  • Last Modified:

Changing Panel without flicker

I have Option panel based on the selection on this panel,
I need to change the right panel based on the selection made by user. I doing this by removeing current Panel and adding the new code:  Panel.remove(currPanel); Panel.add(newPanel) and after that I am issuing panel.repaint() and panel.validate() as panel.repaint() is not showing the current panel, but validate works but the "Problems is it Flickers a lot".

Please suggeest is there is any better method of doing
this

Thank u verymuch
bye
shantharam
0
shanthipower
Asked:
shanthipower
  • 2
  • 2
1 Solution
 
conickCommented:
If I understand the situation I would use a CardLayout manager.
That way you can flip between the two without having to create a whole new panel each time a user makes a choice.  There is alot of overhead in destroying and then creating new panels.  It is much easier and faster to keep the same panels and changing the relevent components on the panels.
I dont know a whole lot about the project but that is my take with the info I have.
repaint() simply paints the layout that the component thinks it has already (does not relayout the components (no layout calculations))
validate() goes through the layout process (calculations are made as to where children should appear)
if you are adding/subtracting components validate is the correct choice.
0
 
heyhey_Commented:
CardLayout will do everything for you.

0
 
heyhey_Commented:
conick, post an answer.
0
 
conickCommented:
Okey...
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now