• 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

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

 
Greenhorn
Posts: 24
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Your mind is under my control .... your will is now mine .... read this tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic