Source Code : Panel Builder Example 2

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Panel Builder Example 2

Panel Builder Example 2
/*
Code revised from Desktop Java Live:
http://www.sourcebeat.com/downloads/
*/


import java.awt.BorderLayout;

import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;

import com.jgoodies.forms.builder.PanelBuilder;
import com.jgoodies.forms.layout.FormLayout;

public class PanelBuilderExample2 extends JPanel {
    public PanelBuilderExample2() {
      super(new BorderLayout());

        PanelBuilder builder = new PanelBuilder(new FormLayout(""));
        builder.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
        builder.appendColumn("right:pref");
        builder.appendColumn("fill:max(pref; 100px)");

        builder.appendRow("top:pref");
        builder.addLabel("First:");
        builder.nextColumn();
        builder.add(new JTextField());

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addLabel("Last:");
        builder.nextColumn();
        builder.add(new JTextField());

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addLabel("Married:");
        builder.nextColumn();
        builder.add(new JCheckBox());

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addLabel("Phone:");
        builder.nextColumn();
        builder.add(new JTextField());

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addLabel("Fax:");
        builder.nextColumn();
        builder.add(new JTextField());

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addLabel("Email:");
        builder.nextColumn();
        builder.add(new JTextField());

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addSeparator("Work");

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addLabel("Company:");
        builder.nextColumn();
        builder.add(new JTextField());

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addLabel("Phone:");
        builder.nextColumn();
        builder.add(new JTextField());

        builder.appendRow("top:pref");
        builder.nextLine();
        builder.addLabel("Fax:");
        builder.nextColumn();
        builder.add(new JTextField());

        add(builder.getPanel());
    }

    public static void main(String[] a){
      JFrame f = new JFrame("FormLayout: Panel Builder Example 2");
      f.setDefaultCloseOperation(2);
      f.add(new PanelBuilderExample2());
      f.pack();
      f.setVisible(true);
    }
}


           
       

Thank with us