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();
}
}
要求在点提交的时候,能够检验出所填的信息的正确性!
比如产品编号只能是数字,填字母啊什么的,在点提交就会提示编号那里错误。
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();
}
}
要求在点提交的时候,能够检验出所填的信息的正确性!
比如产品编号只能是数字,填字母啊什么的,在点提交就会提示编号那里错误。
解决方案 »
- getHibernateTemplate.find(hql)
- tomcat配置虚拟主机问题
- Hibernate在不删除主对象的情况下,如何通过主对象删除其子对象?
- 一个关于<html>下的<Map>问题
- jsp 中如何屏蔽状态栏的超链地址
- Hibernate使用Oracle 的序列,使用createSQLQuery 出现异常:could not execute native bulk manip
- 急求ejb发布出错问题!高分急求!
- 求用java来生成xml文件的方法?
- 50分!我用jb9+tomcat4.1 ,请求页面的时候控制台窗口提示“Context path /defaultroot is already in use”
- 新手求教,急!如何用socket实现文件传输
- 怎么出现这种错误了
- 调用C++动态库错误 --> Java VM: Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode
但是老师校对这个作业就只给我们大概思路啊!
我迷糊啊!!
还有就是那个JAVA包的帮助文档看不懂
但是老师校对这个作业就只给我们大概思路啊!
我迷糊啊!!
还有就是那个JAVA包的帮助文档看不懂