Java Swing FlowLayout getFlowLayoutPanelLeftAligned(String title, Component component)

Here you can find the source of getFlowLayoutPanelLeftAligned(String title, Component component)

Description

get Flow Layout Panel Left Aligned

License

Apache License

Declaration

public static JPanel getFlowLayoutPanelLeftAligned(String title, Component component) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.awt.Component;
import java.awt.FlowLayout;

import javax.swing.BorderFactory;

import javax.swing.JPanel;

public class Main {
    public static JPanel getFlowLayoutPanelLeftAligned(Component component) {
        return getFlowLayoutPanelLeftAligned(null, component);
    }/*  w  ww .  java  2s.  c o m*/

    public static JPanel getFlowLayoutPanelLeftAligned(String title, Component component) {
        JPanel jp = new JPanel();
        jp.setLayout(new FlowLayout(FlowLayout.LEFT));
        if (title != null) {
            if (component instanceof JPanel) {
                JPanel p = (JPanel) component;
                p.setBorder(BorderFactory.createTitledBorder(title));
            }
        }
        jp.add(component);
        return jp;
    }
}

Related

  1. addToFlowLayout(JComponent comp, int flowLayoutAlignment)
  2. createPanel(LayoutManager layout, Component... components)
  3. flowLayoutPanel(Component... components)
  4. layoutFlow(JComponent... list)
  5. wrapInPanel(final JComponent comp, final LayoutManager lm)