Here you can find the source of makeLateralBorders(JPanel panel, Dimension reference, Border style)
public static void makeLateralBorders(JPanel panel, Dimension reference, Border style)
//package com.java2s; //License from project: Open Source License import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.Border; public class Main { public static void makeLateralBorders(JPanel panel, Dimension reference, Border style) { JLabel placeHolder = new JLabel(""); placeHolder.setBorder(style);//w w w . j a v a2 s . co m placeHolder .setPreferredSize(new Dimension((int) (reference.getWidth() / 16), (int) (reference.getHeight()))); panel.add(placeHolder, BorderLayout.WEST); placeHolder = new JLabel(""); placeHolder.setBorder(style); placeHolder .setPreferredSize(new Dimension((int) (reference.getWidth() / 32), (int) (reference.getHeight()))); panel.add(placeHolder, BorderLayout.EAST); } }