Java tutorial
//package com.java2s; import java.awt.GridLayout; import javax.swing.JPanel; public class Main { public static void getPanelGridLayout(JPanel panel, int rows, int cols) { panel.setLayout(new GridLayout(rows, cols, 1, 1)); } }