static int withMargin_defaultWidth = 6; static JPanel withMargin(Component c) { JPanel p = new JPanel(new BorderLayout); int w = withMargin_defaultWidth; p.setBorder(BorderFactory.createEmptyBorder(w, w, w, w)); p.add(c); ret p; }