• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing re-paint issue

 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Jtree which allows me to select different nodes. Based on the level of the selected node, I display a different panel on the right of the tree. This works except for one thing. When I switch back and forth it stops painting the panel correctly. It doesn't show up until you move the mouse over some of the components when they suddenly appear.

Here's what I'm doing:



In short, I remove the panel from the parent, add the new one, and then validate.

Any suggestions?

ms
 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I seem to have solved this myself, though I'd like to understand why the solution is required...

Adding a call to repaint() seems to solve the problem. But why is an explicit call to repaint required? What are the criteria which indicate a repaint is required?

ms
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic