• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Repainting Screen

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That works! But why? Isn't validate/invalidate/revaliate supposed to go through the children components?
 
Goodbye moon men. Hello tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic