Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error Package import com.jgoodies.forms.builder.PanelBuilder doesnt exist

807601Apr 15 2008 — edited Apr 15 2008
hello
can anyone plz help me am trying for the class PanelBuilder and i got this error

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.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;

public class PanelBuilderExample1 extends JPanel {
    public PanelBuilderExample1() {
      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)");

        CellConstraints c = new CellConstraints();

        builder.appendRow("top:pref");
        builder.addLabel("First:", c.xy(1, 1));
        builder.add(new JTextField(), c.xy(2, 1));

        builder.appendRow("top:pref");
        builder.addLabel("Last:", c.xy(1, 2));
        builder.add(new JTextField(), c.xy(2, 2));

        builder.appendRow("top:pref");
        builder.addLabel("Married:", c.xy(1, 3));
        builder.add(new JCheckBox(), c.xy(2, 3));

        builder.appendRow("top:pref");
        builder.addLabel("Phone:", c.xy(1, 4));
        builder.add(new JTextField(), c.xy(2, 4));

        builder.appendRow("top:pref");
        builder.addLabel("Fax:", c.xy(1, 5));
        builder.add(new JTextField(), c.xy(2, 5));

        builder.appendRow("top:pref");
        builder.addLabel("Email:", c.xy(1, 6));
        builder.add(new JTextField(), c.xy(2, 6));

        builder.appendRow("top:pref");
        builder.addSeparator("Work", c.xywh(1, 7, 2, 1));

        builder.appendRow("top:pref");
        builder.addLabel("Company:", c.xy(1, 8));
        builder.add(new JTextField(), c.xy(2, 8));

        builder.appendRow("top:pref");
        builder.addLabel("Phone:", c.xy(1, 9));
        builder.add(new JTextField(), c.xy(2, 9));

        builder.appendRow("top:pref");
        builder.addLabel("Fax:", c.xy(1, 10));
        builder.add(new JTextField(), c.xy(2, 10));

        add(builder.getPanel());
    }

    public static void main(String[] a){
      JFrame f = new JFrame("FormLayout: Panel Builder Example 1");
      f.setDefaultCloseOperation(2);
      f.add(new PanelBuilderExample1());
      f.pack();
      f.setVisible(true);
    }
}
Edited by: pawankarra on Apr 14, 2008 10:57 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2008
Added on Apr 15 2008
9 comments
712 views