0

I am trying to add a GridLayout to a GroupLayout in my Java GUI. I know that I can add components such as buttons, text boxes, panels, etc. to the GroupLayout by using .addComponent('componentName') but it does not work for adding a GridLayout.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Daniel
  • 3
  • 3

1 Answers1

2

You don't add layouts to layouts, but rather components to containers. If you want to add "GridLayout" behavior to a GroupLayout using container, you'll need to create a JPanel that uses a GridLayout, and then add that JPanel to the GroupLayout-using container in a fashion as you've mentioned above.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
  • That's what I ended up doing. I didn't know if there was a way to add the layout to the layout though. Thank you for your response :) – Daniel Sep 25 '16 at 17:04