• Post Reply Bookmark Topic Watch Topic
  • New Topic

What's the best layout for this?  RSS feed

 
Jane Jukowsky
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • 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.
 
Rob Camick
Ranch Hand
Posts: 2756
12
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Perfect, that's just what I need. The whole website is worth looking at. Thanks!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!