import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
public class Main {
public static void main(String[] argv) throws Exception {
JButton component1 = new JButton();
JButton component2 = new JButton();
int rows = 2;
int cols = 2;
JPanel panel = new JPanel(new GridLayout(rows, cols));
panel.add(component1);
panel.add(component2);
}
}