Java JPanel Child padPanel(Object innerPanel, JPanel outerPanel, int pad)

Here you can find the source of padPanel(Object innerPanel, JPanel outerPanel, int pad)

Description

pad Panel

License

Open Source License

Declaration

public static void padPanel(Object innerPanel, JPanel outerPanel,
            int pad) 

Method Source Code

//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);
    }
}

Related

  1. addWithPadding(JPanel parentPanel, JPanel panelToBeAdded)
  2. fillPanel(final JPanel panel, final GridBagConstraints gbc)
  3. fillPanel(JPanel panel, Component... components)
  4. getOutermostContainer(JPanel container)
  5. packPanel(JPanel p, int width)
  6. removeComponentFromPanel(Component removeComponent, JPanel fromPanel)
  7. removePanel(JPanel parent, JPanel panel)
  8. resetControlsInAPanel(JPanel panel)
  9. resizeJPanel(JPanel p)