Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to keep a GridBagLayout horizontal-axis responsive on resize and always show a vertical scroller  RSS feed

 
Peter Lock
Greenhorn
Posts: 24
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

Does anyone know how to keep a GridBagLayout responsive on resize and always show vertical scroll bars? I need to make something that is responsive, for smaller screens (to 1024x640) and include scroll bars. Ive tried different ideas but am missing something here. If possible can someone please take a look at the cut down code and see whats wrong with respect to making it include scrollbars and be responsive. The program needs to be able to resize from 1280x800 to 1024x640 and always include a vertical scroller. The Grid needs to stay responsive to keep everything on the horizontal axis visible (without horizontal scroller) while the vertical scroller needs to do its thing and remain visible.

At the moment when I add scroll bars the Grid full extends, taking away the benefit of using the GridBag.

Regards


 
Peter Lock
Greenhorn
Posts: 24
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answered: Don't forget to set panel.setMaximumSize, and panel.setPreferredSize on the panel being wrapped in the scroller . After adding this everything worked like a treat. I hope this can help someone else out there.

Regards
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!