wrap In FlowLayout Panel - Java Swing

Java examples for Swing:Layout Manager

Description

wrap In FlowLayout Panel

Demo Code


//package com.java2s;
import javax.swing.*;
import java.awt.*;

public class Main {
    public static JPanel wrapInFlowLayoutPanel(JComponent component,
            int align, int hgap, int vgap) {
        JPanel panel = new JPanel();
        panel.setLayout(new FlowLayout(align, hgap, vgap));
        panel.add(component);/*from  w  ww  .  ja va  2s  .  c  o m*/
        return panel;
    }
}

Related Tutorials