Java GridBagLayout - How to position my components gap-less and one by one?
I'm using GridBagLayout to place my GUI components by the following code, wanting the components lay one by one in a column, without any gaps : import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class TestGUI extends JFrame{ public TestGUI(){ JPanel bigPanel = new JPanel(new GridBagLayout()); JPanel panel_a = new JPanel(); JButton btnA = new JButton("button a"); panel_a.add(btnA); JPanel panel_b = new JPanel(); JButton btnB = new JButton("button b"); panel_b.add(btnB); GridBagConstraints c