Here you can find the source of buildPanelEmptyBorder(final JComponent content, final int top, final int left, final int bottom, final int right)
public static JComponent buildPanelEmptyBorder(final JComponent content, final int top, final int left, final int bottom, final int right)
//package com.java2s; /******************************************************************************* * Copyright (c) 2015, 2017 Lablicate GmbH. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from www . jav a 2s. c o m * Dr. Alexander Kerner - initial API and implementation *******************************************************************************/ import java.awt.BorderLayout; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JPanel; public class Main { public static JComponent buildPanelEmptyBorder(final JComponent content, final int top, final int left, final int bottom, final int right) { final JPanel result = new JPanel(new BorderLayout()); result.setBorder(BorderFactory.createEmptyBorder(top, left, bottom, right)); result.add(content, BorderLayout.CENTER); return result; } }