Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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
  • 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
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic