you could use a BoxLayout and in the constructor set the layout type to Box.Y_AXIS, and with this all of the widgets will fall under the previous one added, OR you could still use the GridLayout but add each individual widget to its own JPanel before adding that JPanel to the GridLayout, that will prevent the oversizing problem that you would normally have, and btw you dont have to store any reference to the JPanel's just instantiate, add a widgets, and add the panel until all widgets are taken care of
↧