posted 14 years ago
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.