• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Repainting Screen

 
Terry McKee
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There seems to be a couple of threads already out there on this topic, but I haven't found a resolution that works for me. I currently have a JFrame that has a BorderLayout Layout Manager. In the center area, I add a JSplitPane called mainArea. Finally, I add a navigationPane in the left area of the mainArea.

I have a view -> navigation menu item that should toggle whether the navigationPane is visible. Initially, the navigation menu is not visible. When I select the navigation menu item the first time, the navigation panel becomes visible. When I select the navigation menu item a second time, the navigation panel becomes invisible. Everything works great up to this point.
When I select the navigation menu a third time, nothing happens. The navigation panel should be visible, but nothing happens until I physically drag the split pane divider. I have tried invalidating and then repainting, but it doesn't work.
Any suggestions?
 
Terry McKee
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using the setVisible command, I tried removing and adding the component to the container and that seems to work. Nevertheless, I am sure that I will come across this issue again some day. Any help would be greatly appreciated. Any thoughts?
Thanks.
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Terry,
did you also try validateTree() of the JFrame? This is a bit better than calling repaint.
Rene
 
Terry McKee
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't tried validateTree() yet. I'll see what happens.
 
Terry McKee
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That works! But why? Isn't validate/invalidate/revaliate supposed to go through the children components?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic