import javax.swing.*;
import java.awt.*;
import java.lang.*;
/*
 *产品信息处理界面 (加入图标)
 */
public class ProductGUI extends JFrame
{
JFrame frame;     //声明容器类变量
Container content;

JLabel labelProductNo;
JLabel labelProductName;
JLabel labelProductClass;
JLabel labelProductType;
JLabel labelProductNumber;
JLabel labelMinNumber;
JLabel labelProductArea;
    JLabel labelSupplierCompany;
JLabel labelProductDescript;
JLabel label;

JLabel labelLOGO;
JLabel labelTitle;
    JLabel labelSpace;

JTextField textProductNo;
JTextField textProductName;
JTextField textProductClass;
JTextField textProductType;
JTextField textProductNumber;
JTextField textMinNumber;
JTextField textProductArea;
JTextField textSupplierCompany;
JTextField textProductDescript;


JButton buttonSubmit;
JButton buttonCancel;
//声明布局类变量
GridBagLayout gl;
GridBagConstraints gbc;

public ProductGUI()
{
//frame = new JFrame();
    super("产品信息录入");
//实例化布局类对象
gl = new GridBagLayout();
gbc =  new GridBagConstraints();
content = this.getContentPane();
//设置布局
content.setLayout(gl);


//实例化标签对象
labelProductNo = new JLabel("产品编号");
labelProductName = new JLabel("产品名称");
labelProductClass = new JLabel("产品类别");
labelProductType = new JLabel("产品型号");
labelProductNumber = new JLabel("数量");
labelMinNumber = new JLabel("安全库存");
labelProductArea = new JLabel("生产地区");
labelSupplierCompany = new JLabel("供应商");
labelProductDescript = new JLabel("产品描述");
//LOGO
labelLOGO=new JLabel(new ImageIcon("images/logo.gif"));
//标题设置字体,颜色
labelTitle=new JLabel("安达仓库管理系统");
labelTitle.setFont(new Font("Serif",Font.BOLD+Font.ITALIC,18));
labelTitle.setForeground(Color.BLUE);
labelSpace=new JLabel("    ");


//实例化文本框对象
textProductNo = new JTextField(5);
textProductName = new JTextField(10);
textProductClass = new JTextField(10);
textProductType = new JTextField(10);
textProductNumber = new JTextField(10);
textMinNumber = new JTextField(10);
textProductArea = new JTextField(20);
textSupplierCompany = new JTextField(20);
textProductDescript = new JTextField(40);


//实例化按钮对象
buttonSubmit = new JButton("提交");
buttonCancel = new JButton("取消");

//设置组件的位置
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 2;
gl.setConstraints(labelLOGO,gbc);
content.add(labelLOGO);

//设置组件的位置
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 4;
gbc.gridy = 2;
gl.setConstraints(labelTitle,gbc);
content.add(labelTitle);

//设置组件的位置
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 3;
gl.setConstraints(labelSpace,gbc);
content.add(labelSpace);

//设置组件的位置
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 5;
gl.setConstraints(labelProductNo,gbc);
content.add(labelProductNo);


gbc.gridx = 4;
gbc.gridy = 5;
gl.setConstraints(textProductNo,gbc);
content.add(textProductNo);
gbc.gridx = 1;
gbc.gridy = 8;
gl.setConstraints(labelProductName,gbc);
content.add(labelProductName);
gbc.gridx = 4;
gbc.gridy = 8;
gl.setConstraints(textProductName,gbc);
content.add(textProductName);
gbc.gridx = 1;
gbc.gridy = 11;
gl.setConstraints(labelProductClass,gbc);
content.add(labelProductClass);


gbc.gridx = 4;
gbc.gridy = 11;
gl.setConstraints(textProductClass,gbc);
content.add(textProductClass);
gbc.gridx = 1;
gbc.gridy = 14;
gl.setConstraints(labelProductType,gbc);
content.add(labelProductType);


gbc.gridx = 4;
gbc.gridy = 14;
gl.setConstraints(textProductType,gbc);
content.add(textProductType);


gbc.gridx = 1;
gbc.gridy = 17;
gl.setConstraints(labelProductNumber,gbc);
content.add(labelProductNumber);


gbc.gridx = 4;
gbc.gridy = 17;
gl.setConstraints(textProductNumber,gbc);
content.add(textProductNumber);


gbc.gridx = 1;
gbc.gridy = 20;
gl.setConstraints(labelMinNumber,gbc);
content.add(labelMinNumber);


gbc.gridx = 4;
gbc.gridy = 20;
gl.setConstraints(textMinNumber,gbc);
content.add(textMinNumber);


gbc.gridx = 1;
gbc.gridy = 23;
gl.setConstraints(labelProductArea,gbc);
content.add(labelProductArea);


gbc.gridx = 4;
gbc.gridy = 23;
gl.setConstraints(textProductArea,gbc);
content.add(textProductArea);


gbc.gridx = 1;
gbc.gridy = 26;
gl.setConstraints(labelSupplierCompany,gbc);
content.add(labelSupplierCompany);


gbc.gridx = 4;
gbc.gridy = 26;
gl.setConstraints(textSupplierCompany,gbc);
content.add(textSupplierCompany);


gbc.gridx = 1;
gbc.gridy = 29;
gl.setConstraints(labelProductDescript,gbc);
content.add(labelProductDescript);


gbc.gridx = 4;
gbc.gridy = 29;
gl.setConstraints(textProductDescript,gbc);
content.add(textProductDescript);
gbc.gridx = 8;
gbc.gridy = 32;
gl.setConstraints(buttonSubmit,gbc);
content.add(buttonSubmit);

gbc.gridx = 10;
gbc.gridy = 32;
gl.setConstraints(buttonCancel,gbc);
content.add(buttonCancel);

            this.setSize(650,400);
this.setVisible(true);
    }
   
   
public static void main(String[] args)
{
ProductGUI obj = new ProductGUI();

}
}
要求在点提交的时候,能够检验出所填的信息的正确性!
比如产品编号只能是数字,填字母啊什么的,在点提交就会提示编号那里错误。