• 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

What's the best layout for this?

 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There has to be an easy solution to this. I need to lay out a bunch of equally sized JButtons on a JPanel on a JScrollPane. The trick is,

1) JButtons wrap, as in FlowLayout;

2) when JScrollPane is resized, the width of JPanel should change accordingly, so that there is never a horizontal toolbar (and all JButtons re-wrap accordingly); there may be a vertical toolbar

3) whenever JScrollPane is resized, the height of JPanel should change so that the last JButton can still be scrolled to.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you can use the Wrap Layout
 
Jane Jukowsky
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perfect, that's just what I need. The whole website is worth looking at. Thanks!
reply
    Bookmark Topic Watch Topic
  • New Topic