0

I am using WindowBuilder and I created a JFrame with many JButton components and I would like to see my buttons resize automatically. The only solutions that I found is by using GroupLayout, is any other way to do it with any layout (I am using absolute layout)?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Yes, there are a variety of layouts that can achieve that. Which one (or ones) to use depend on the required effect. Provide ASCII art or a simple drawing of the *intended* layout of the GUI at minimum size, and with more width and height - to show how the extra space should be used. – Andrew Thompson Jun 19 '21 at 04:49
  • BTW - Absolute layout is a `null` layout pretending to be a layout - don't use it *ever*. `GroupLayout` is only really useful when using a GUI builder and is hard to edit later by hand. Don't use a GUI builder until you understand how the inbuilt layouts work, and how they can be combined. – Andrew Thompson Jun 19 '21 at 04:52
  • The JButtons can get larger with a larger JPanel, but the font size of the JButtons will remain the same. If you want a completely dynamic layout, you'll have to calculate the appropriate JButton text font size as well. A GridLayout will make the JButtons larger on a larger JPanel. – Gilbert Le Blanc Jul 05 '21 at 19:58

0 Answers0