Java JLabel Create createFormPanel(JLabel label, JComponent component)

Here you can find the source of createFormPanel(JLabel label, JComponent component)

Description

create Form Panel

License

Open Source License

Declaration

public static JPanel createFormPanel(JLabel label, JComponent component) 

Method Source Code


//package com.java2s;
/*/*www .j a  v a2s. c  o m*/
 * patchanim - A bezier surface patch color blend animation builder
 * Copyright (C) 2008-2015 Dave Brosius
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

import java.awt.BorderLayout;

import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Main {
    public static JPanel createFormPanel(JLabel label, JComponent component) {
        JPanel p = new JPanel();
        p.setLayout(new BorderLayout(4, 4));
        label.setLabelFor(component);
        p.add(label, BorderLayout.WEST);
        p.add(component, BorderLayout.CENTER);
        return p;

    }
}

Related

  1. createCenteredLabel(JLabel label)
  2. createJLabel(Container c, String caption, int x, int y)
  3. createJLabel(final String text, final Font font, final Color color)
  4. createJLabel(String mlabel)
  5. createJLabel(String text, Font font)