| Author |
Repainting Screen
|
Terry McKee
Ranch Hand
Joined: Sep 29, 2000
Posts: 173
|
|
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
Joined: Sep 29, 2000
Posts: 173
|
|
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
Joined: May 02, 2002
Posts: 196
|
|
Terry, did you also try validateTree() of the JFrame? This is a bit better than calling repaint. Rene
|
 |
Terry McKee
Ranch Hand
Joined: Sep 29, 2000
Posts: 173
|
|
|
I haven't tried validateTree() yet. I'll see what happens.
|
 |
Terry McKee
Ranch Hand
Joined: Sep 29, 2000
Posts: 173
|
|
|
That works! But why? Isn't validate/invalidate/revaliate supposed to go through the children components?
|
 |
 |
|
|
subject: Repainting Screen
|
|
|