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

Dynamically Rearranging a Layout.  RSS feed

 
Elam Daly
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Lets say I have a JPanel with a preset layout, which consists of buttons and combo boxes. If the user presses the button, I would like to add another combo box. The version I coded calls the repaint method on the JPanel in question, but the changes only show if I resize the JPanel. Is there a way to have the Panel repaint without resizing?

 
Scott Delap
author
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try calling revalidate() as well.

Scott Delap
ClientJava.com
Desktop Java Live
 
Elam Daly
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That did it. Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!