Here you can find the source of addToFlowLayout(JComponent comp, int flowLayoutAlignment)
public static JPanel addToFlowLayout(JComponent comp, int flowLayoutAlignment)
//package com.java2s; //License from project: Apache License import java.awt.FlowLayout; import javax.swing.JComponent; import javax.swing.JPanel; public class Main { public static JPanel addToFlowLayout(JComponent comp, int flowLayoutAlignment) { JPanel panel = new JPanel(new FlowLayout(flowLayoutAlignment)); panel.add(comp);//from w w w . j av a2s . co m return panel; } }