Java tutorial
//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); return panel; } }