Here you can find the source of getPanelFor(JComponent comp1, JComponent comp2)
public static JPanel getPanelFor(JComponent comp1, JComponent comp2)
//package com.java2s; /*// w ww . ja va 2 s. com * @(#)Util.java * * Created on 2005. 12. 15 * * This software is the confidential and proprietary informatioon of * POSTECH DP&NM. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Eric Kang. * * Contact: Eric Kang at eliot@postech.edu */ import javax.swing.*; import java.awt.*; public class Main { public static JPanel getPanelFor(JComponent comp1, JComponent comp2) { JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT)); panel.add(comp1); panel.add(comp2); return panel; } public static JPanel getPanelFor(JComponent comp1, JComponent comp2, JComponent comp3) { JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT)); panel.add(comp1); panel.add(comp2); panel.add(comp3); return panel; } }