Here you can find the source of padPanel(Object innerPanel, JPanel outerPanel, int pad)
public static void padPanel(Object innerPanel, JPanel outerPanel, int pad)
//package com.java2s; //License from project: Open Source License import javax.swing.*; import java.awt.*; public class Main { public static void padPanel(Object innerPanel, JPanel outerPanel, int pad) { final GridBagConstraints c; c = new GridBagConstraints(); c.gridx = 0;//from w ww .j ava 2s . c o m c.gridy = 0; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(pad, pad, pad, pad); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; outerPanel.add((Component) innerPanel, c); } }