Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I force a container to repaint?  RSS feed

 
Tom Niesytto
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy (no I am not from TX),
let's assume I have a JFrame with FlowLayout.
I add some components to it and do setVisible().
Later I decide to change some layout parameter
eg. do setHgap() on the FlowLayout object.
Now - how do I force JFrame to repaint?
Thanks,
Tom
 
Tom Niesytto
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to enhance the question...
I tried to use update(Graphics) (after resetting hgap)
and adding my own paint(Graphics) method but then
the effect of changing hgap is visible only after
window is resized (and after going out of focus and back
to clear clutter).
Sorry for trivial question but I cannot seem to find the
answer in books that I have.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try calling validate() (from Component) on the container.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!