java鲜花销售系统案例(图形层)

类cusById

//顾客个人信息窗口

package Graph;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import DAO.CustomerDAO;
import Factory.DAOFactory;
import Factory.Flofactory;
import SqlExecute.SqlCustomerImpl;
import StoreManager.Customer;

public class cusById_gra {
	CustomerDAO cusDao = DAOFactory.getCustomerDAO();
	Flofactory flo = new Flofactory();
	Customer cus = flo.getCustomer();
	public String identity = "";
	public cusById_gra(String identity) throws Exception{
		this.identity = identity;
		JFrame frame = new JFrame();
		frame.setTitle("个人信息");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		String[] columnNames = new String[] { "顾客id", "密码", "联系方式","余额" };
		JTable table = new JTable(cusDao.queryById(identity),columnNames);
		JScrollPane table1 = new JScrollPane(table);
        frame.add(table1,BorderLayout.CENTER);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("更改信息");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		JButton button3 = new JButton();
		button3.setText("充值");
		button3.setFont(new Font("宋体",Font.PLAIN,14));
		button3.setSize(dim2);
		JButton button2 = new JButton();
		button2.setText("确定");
		button2.setFont(new Font("宋体",Font.PLAIN,14));
		button2.setSize(dim2);
		JPanel panel = new JPanel(new GridLayout(1,3,10,100));
		panel.add(button1);
		panel.add(button3);
		panel.add(button2);
		frame.add(panel,BorderLayout.SOUTH);
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				update_gra();
				frame.setVisible(false);
			}
		});
		button2.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				frame.setVisible(false);
			}
		});
		button3.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				add_gra();
				frame.setVisible(false);
			}
		});
	}
	
	public void update_gra(){
		JFrame frame = new JFrame();
		frame.setTitle("信息更改");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		Dimension dim1 = new Dimension(300,30);
		JLabel label = new JLabel("更新后信息:");
		label.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(label,BorderLayout.NORTH);
		JPanel panel = new JPanel(new GridLayout(4,2));
		JLabel labpass = new JLabel("密码:");
		labpass.setFont(new Font("宋体",Font.PLAIN,14));
		panel.add(labpass);
		JTextField text_password = new JTextField();
		text_password.setPreferredSize(dim1);
		panel.add(text_password);;
		JLabel jphone = new JLabel();
		jphone.setText("电话:");
		jphone.setFont(new Font("宋体",Font.PLAIN,14));
		panel.add(jphone);
		JTextField text_phone = new JTextField();
		text_phone.setPreferredSize(dim1);
		panel.add(text_phone);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("更新");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		for(int i=0;i<4;i++)
		{
			panel.add(new JLabel());
		}
		frame.add(panel,BorderLayout.CENTER);
		frame.add(button1,BorderLayout.SOUTH);
		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				cus.setCusid(identity+"");
				cus.setPassword(text_password.getText());
				cus.setCusphone(text_phone.getText());
				try {
					cusDao.update2(cus);
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				frame.setVisible(false);
				try {
					cusById_gra cgra = new cusById_gra(identity);
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
	}
	
	public void add_gra(){
		JFrame frame = new JFrame();
		frame.setTitle("余额充值");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);

		frame.setLayout(fl);
		Dimension dim1 = new Dimension(400,30);
		JLabel label = new JLabel("顾客id:");
		label.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(label);
		JTextField text_id = new JTextField();
		text_id.setPreferredSize(dim1);
		frame.add(text_id);;
		JLabel money = new JLabel();
		money.setText("金额:");
		money.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(money);
		JTextField text_money = new JTextField();
		text_money.setPreferredSize(dim1);
		frame.add(money);
		frame.add(text_money);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("确定");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		frame.add(button1);
		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				cus.setCusid(text_id.getText());
				cus.setBalance(Integer.parseInt(text_money.getText()));
				try {
					JButton button = new JButton("确定");
					if(cusDao.update1(cus) == 1)
						JOptionPane.showMessageDialog(button, "充值成功!");
					else {
						JOptionPane.showMessageDialog(button, "充值失败!");
					}
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				frame.setVisible(false);
				try {
					cusById_gra cgra = new cusById_gra(identity);
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
	}
}

类customer

//管理员对顾客表操作窗口

package Graph;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import DAO.CustomerDAO;
import Factory.DAOFactory;
import Factory.Flofactory;
import StoreManager.Customer;

public class customer_gra {
	CustomerDAO cusDao = DAOFactory.getCustomerDAO();
	Flofactory flo = new Flofactory();
	Customer cus = flo.getCustomer();
	public customer_gra() throws Exception{
		JFrame frame = new JFrame();
		frame.setTitle("鲜花销售系统");//设置窗体标题
		frame.setSize(600, 400);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		JLabel label = new JLabel("员工信息",JLabel.CENTER);
		label.setSize(500,50);
		String[] columnNames = new String[] { "顾客id", "密码", "联系方式","余额"  };
		List content = cusDao.queryAll();
		String[][] tabcontent = new String[content.size()/4][4];
		int n = 0;
		for(int i=0;i

类flower

//鲜花操作窗口

package Graph;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import DAO.FlowerDAO;
import Factory.DAOFactory;
import Factory.Flofactory;
import SqlExecute.SqlFlowerImpl;
import StoreManager.Flower;

public class flower_gra {
	FlowerDAO floDao = DAOFactory.getFlowerDAO();
	Flofactory flo = new Flofactory();
	Flower flow = flo.getFlower();
	public flower_gra() throws Exception{
		JFrame frame = new JFrame();
		frame.setTitle("鲜花销售系统");//设置窗体标题
		frame.setSize(600, 400);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		JLabel label = new JLabel("鲜花信息",JLabel.CENTER);
		label.setSize(500,50);
		String[] columnNames = new String[] { "编号", "名称", "价格", "库存" };
		List content = floDao.queryAll();
		String[][] tabcontent = new String[content.size()/4][4];
		int n = 0;
		for(int i=0;i content = floDao.queryAll();
		String[][] tabcontent = new String[content.size()/4][4];
		int n = 0;
		for(int i=0;i getId = floDao.queryAll();
		int id = Integer.parseInt(getId.get(getId.size()-4));
		JPanel panel1 = new JPanel(new GridLayout(5,5));
		JLabel labname = new JLabel("鲜花编号:");
		labname.setFont(new Font("宋体",Font.PLAIN,14));
		panel1.add(labname);
		JTextField text_name = new JTextField();
		Dimension dim1 = new Dimension(300,30);
		text_name.setPreferredSize(dim1);
		text_name.setText(id+1+"");
		text_name.setEditable(false);
		panel1.add(text_name);
		JLabel labpass = new JLabel("鲜花名称:");
		labpass.setFont(new Font("宋体",Font.PLAIN,14));
		panel1.add(labpass);
		JTextField text_password = new JTextField();
		text_password.setPreferredSize(dim1);
		panel1.add(text_password);
		JLabel jpost = new JLabel();
		jpost.setText("价格:");
		jpost.setFont(new Font("宋体",Font.PLAIN,14));
		panel1.add(jpost);
		JTextField text_post = new JTextField();
		text_post.setPreferredSize(dim1);
		panel1.add(text_post);
		JLabel jphone = new JLabel();
		jphone.setText("库存数量:");
		jphone.setFont(new Font("宋体",Font.PLAIN,14));
		panel1.add(jphone);
		JTextField text_phone = new JTextField();
		text_phone.setPreferredSize(dim1);
		panel1.add(text_phone);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("入库");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		frame.add(panel1,BorderLayout.CENTER);
		frame.add(button1,BorderLayout.SOUTH);

		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				flow.setFlid(Integer.parseInt(text_name.getText()));
				flow.setFlname(text_password.getText());
				flow.setPrice(Integer.parseInt(text_post.getText()));
				flow.setStore(Integer.parseInt(text_phone.getText()));
				try {
					floDao.insert(flow);
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				frame.setVisible(false);
				try {
					flower_gra fgra = new flower_gra();
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
	}
	
	public void delete_gra(){
		JFrame frame = new JFrame();
		frame.setTitle("鲜花出库");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);

		frame.setLayout(fl);
		JLabel labname = new JLabel("鲜花编号:");
		labname.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(labname);
		JTextField text_name = new JTextField();
		Dimension dim1 = new Dimension(300,30);
		text_name.setPreferredSize(dim1);
		frame.add(text_name);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("删除");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		frame.add(button1);
		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				flow.setFlid(Integer.parseInt(text_name.getText()));
				try {
					floDao.delete(flow.getFlid());
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				frame.setVisible(false);
				try {
					manager_gra mgra = new manager_gra();
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
	}
	
	public void update_gra(){
		JFrame frame = new JFrame();
		frame.setTitle("信息更改");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		JPanel panel1 = new JPanel(new GridLayout(6,6));
		JLabel labname = new JLabel("鲜花编号:");
		labname.setFont(new Font("宋体",Font.PLAIN,14));
		panel1.add(labname);
		JTextField text_name = new JTextField();
		Dimension dim1 = new Dimension(300,30);
		text_name.setPreferredSize(dim1);
		panel1.add(text_name);
		JLabel label = new JLabel("更新后信息:");
		label.setFont(new Font("宋体",Font.PLAIN,14));
		panel1.add(label);
		panel1.add(new JLabel("    "));
		JLabel jpost = new JLabel();
		jpost.setText("价格:");
		jpost.setFont(new Font("宋体",Font.PLAIN,14));
		panel1.add(jpost);
		JTextField text_post = new JTextField();
		text_post.setPreferredSize(dim1);
		panel1.add(text_post);
		JLabel jphone = new JLabel();
		jphone.setText("库存数量:");
		jphone.setFont(new Font("宋体",Font.PLAIN,14));
		panel1.add(jphone);
		JTextField text_phone = new JTextField();
		text_phone.setPreferredSize(dim1);
		panel1.add(text_phone);
		for(int i=0;i<4;i++)
		{
			panel1.add(new JLabel("    "));
		}
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("更新");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		frame.add(panel1,BorderLayout.CENTER);
		frame.add(button1,BorderLayout.SOUTH);

		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				flow.setFlid(Integer.parseInt(text_name.getText()));
				flow.setPrice(Integer.parseInt(text_post.getText()));
				flow.setStore(Integer.parseInt(text_phone.getText()));
				try {
					floDao.update(flow);
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				frame.setVisible(false);
				try {
					flower_gra fgra = new flower_gra();
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
	}
	
	public void query_gra(){
		JFrame frame = new JFrame();
		frame.setTitle("信息查询");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);

		frame.setLayout(fl);
		JLabel labname = new JLabel("查询条件:");
		labname.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(labname);
		JComboBox majorBox = new JComboBox();
		majorBox.addItem("--请选择--");
		//从数据库获取所有的专业,添加到下拉列表中
		majorBox.addItem("鲜花编号");
		majorBox.addItem("鲜花名称");
		frame.add(majorBox);
		JTextField text = new JTextField(20);
		frame.add(text);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("查询");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		frame.add(button1);
		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				try {
					if(majorBox.getSelectedItem().equals("鲜花编号"))
						{
							if(floDao.queryById(Integer.parseInt(text.getText())) != null)
							{
								query(text.getText());
							}
							else {
								query_loss();
							}
						}
					else if(majorBox.getSelectedItem().equals("鲜花名称")){
						if(floDao.queryByName(text.getText())!= null)
						{
							query1(text.getText());
						}
						else {
							query_loss();
						}
					}
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
			}
		});
	}
	
	public void query(String userid) throws Exception{
		JFrame frame = new JFrame();
		frame.setTitle("鲜花信息");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);
		
		frame.setLayout(fl);
		String[] columnNames = new String[] { "编号", "名称", "价格", "库存"  };
		JTable table = new JTable(floDao.queryById(Integer.parseInt(userid)),columnNames);
		JScrollPane table1 = new JScrollPane(table);
        frame.add(table1,BorderLayout.CENTER);

		
		frame.setVisible(true);

	}
	
	public void query1(String userName) throws Exception{
		JFrame frame = new JFrame();
		frame.setTitle("鲜花信息");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);
		
		frame.setLayout(fl);
		String[] columnNames = new String[] { "编号", "名称", "价格", "库存"  };
		JTable table = new JTable(floDao.queryByName(userName),columnNames);
		JScrollPane table1 = new JScrollPane(table);
        frame.add(table1,BorderLayout.CENTER);

		
		frame.setVisible(true);

	}
	
	public void query_loss(){
		JFrame frame = new JFrame();
		frame.setTitle("鲜花信息");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);
		JLabel label = new JLabel("无此鲜花!",JLabel.CENTER);
		frame.setLayout(fl);
		frame.add(label);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("确定");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		frame.add(button1);
		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				frame.setVisible(false);
			}
		});
	}
}

类login

//登录窗口

package Graph;
import java.awt.Dimension;  //封装了一个构件的高度和宽度
import java.awt.FlowLayout;
import java.awt.Font;
 



import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.xml.ws.soap.AddressingFeature;

import Factory.Flofactory;
import SqlExecute.login;
import StoreManager.Customer;
import StoreManager.User;


public class login_gra extends login{
	
	Flofactory flo = new Flofactory();
	User user = flo.getUser();
	Customer cus = flo.getCustomer();
	private String identity = "";
	public login_gra(){
		//设置窗体对象的属性值
		JFrame frame = new JFrame();
		frame.setTitle("Login");//设置窗体标题
		frame.setSize(400, 250);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		
		//实例化FlowLayout流式布局类的对象,指定对齐方式为居中对齐组件之间的间隔为10个像素
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);
		//实例化流式布局类的对象
		frame.setLayout(fl);
		
		//实例化JLabel标签对象,该对象显示“账号”
		JLabel labname = new JLabel("账号:");
		labname.setFont(new Font("宋体",Font.PLAIN,14));
		//将labname标签添加到窗体上
		frame.add(labname);
		JTextField text_name = new JTextField();
		Dimension dim1 = new Dimension(300,30);
		text_name.setPreferredSize(dim1);//设置除顶级容器组件以外其他组件的大小
		//将textName标签添加到窗体上
		frame.add(text_name);
		
		//实例化JLabel标签对象,该对象显示“密码”
		JLabel labpass = new JLabel("密码:");
		labpass.setFont(new Font("宋体",Font.PLAIN,14));
		//将labpass添加到窗体上
		frame.add(labpass);
		
		//实例化JPasswordField
		JPasswordField text_password = new JPasswordField();
		//设置大小
		text_password.setPreferredSize(dim1);
		//添加到窗体
		frame.add(text_password);
		
		//实例化JButton组件
		JButton button1 = new JButton();
		//设置按键的显示内容
		Dimension dim2 = new Dimension(100,30);
		button1.setText("登录");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		//设置按键大小
		button1.setSize(dim2);
		frame.add(button1);
		JButton button2 = new JButton();
		button2.setText("注册");
		button2.setSize(dim2);
		button2.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(button2);
		frame.setVisible(true);//窗体可见,一定要放在所有组件加入窗体后
		button1.addActionListener((new ActionListener() {
			
			@SuppressWarnings("deprecation")
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				if(e.getSource() == button1)
				{
					identity = text_name.getText();
					cus.setCusid(text_name.getText());
					cus.setPassword(text_password.getText());
					try {
						queryLogin1(cus);
						if(flag == 1)
							{
								LoginSucess();
								frame.setVisible(false);
							}
						else
						{
							JButton button = new JButton("确定");
							JOptionPane.showMessageDialog(button, "账号或密码错误!");
						}
					} catch (Exception e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}
			}
		}));
		button2.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				try {
					register_gra rgra = new register_gra();
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
	}
	public login_gra(int i){
		//设置窗体对象的属性值
		JFrame frame = new JFrame();
		frame.setTitle("Login");//设置窗体标题
		frame.setSize(400, 250);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		
		//实例化FlowLayout流式布局类的对象,指定对齐方式为居中对齐组件之间的间隔为10个像素
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);
		//实例化流式布局类的对象
		frame.setLayout(fl);
		
		//实例化JLabel标签对象,该对象显示“账号”
		JLabel labname = new JLabel("账号:");
		labname.setFont(new Font("宋体",Font.PLAIN,14));
		//将labname标签添加到窗体上
		frame.add(labname);
		JTextField text_name = new JTextField();
		Dimension dim1 = new Dimension(300,30);
		text_name.setPreferredSize(dim1);//设置除顶级容器组件以外其他组件的大小
		//将textName标签添加到窗体上
		frame.add(text_name);
		
		//实例化JLabel标签对象,该对象显示“密码”
		JLabel labpass = new JLabel("密码:");
		labpass.setFont(new Font("宋体",Font.PLAIN,14));
		//将labpass添加到窗体上
		frame.add(labpass);
		
		//实例化JPasswordField
		JPasswordField text_password = new JPasswordField();
		//设置大小
		text_password.setPreferredSize(dim1);
		//添加到窗体
		frame.add(text_password);
		
		//实例化JButton组件
		JButton button1 = new JButton();
		//设置按键的显示内容
		Dimension dim2 = new Dimension(100,30);
		button1.setText("登录");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		//设置按键大小
		button1.setSize(dim2);
		frame.add(button1);
		frame.setVisible(true);//窗体可见,一定要放在所有组件加入窗体后
		button1.addActionListener((new ActionListener() {
			
			@SuppressWarnings("deprecation")
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				if(e.getSource() == button1)
				{
					identity = text_name.getText();
					user.setUserid(text_name.getText());
					user.setPassword(text_password.getText());
					
					try {
						queryLogin(user);
						if(flag == 1)
							{
								LoginSucess();
								frame.setVisible(false);
							}
						else
							{
								JButton button = new JButton("确定");
								JOptionPane.showMessageDialog(button, "账号或密码错误!");
							}
					} catch (Exception e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}
			}
		}));
	}
	public void LoginSucess() {
		//设置窗体对象的属性值
		JFrame frame = new JFrame();
		frame.setTitle("Login");//设置窗体标题
		frame.setSize(400, 250);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setResizable(false);//禁止调整窗体大小
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		
		//实例化FlowLayout流式布局类的对象,指定对齐方式为居中对齐组件之间的间隔为10个像素
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);
		//实例化流式布局类的对象
		frame.setLayout(fl);
		
		//实例化JLabel标签对象,该对象显示“账号”
		JLabel lab = new JLabel("登陆成功!");
		frame.add(lab);
		JButton button = new JButton();
		button.setText("确定");
		button.setSize(100,30);
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				frame.setVisible(false);
				try {
					int num = Integer.parseInt(identity);
					if(num > 299999)
					{
						choice1_gra c1gra = new choice1_gra(identity);
					}
					else if(num > 199999){
						choice2_gra c2gra = new choice2_gra(identity);
					}
					else{
						choice_gra cgra = new choice_gra();
					}
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
		frame.add(button);
		frame.setVisible(true);
	}
	
}

类manager

//管理员操作窗口

package Graph;

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import DAO.UserDAO;
import Factory.DAOFactory;
import Factory.Flofactory;
import SqlExecute.SqlManagerImpl;
import StoreManager.User;

public class manager_gra{
	UserDAO userDAO = DAOFactory.getUserDAO();
	Flofactory flo = new Flofactory();
	User user = flo.getUser();
	public manager_gra() throws Exception{
		JFrame frame = new JFrame();
		frame.setTitle("鲜花销售系统");//设置窗体标题
		frame.setSize(600, 400);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		JLabel label = new JLabel("员工信息",JLabel.CENTER);
		label.setSize(500,50);
		String[] columnNames = new String[] { "职工号", "密码", "职位", "联系方式" };
		List content = userDAO.queryAll();
		String[][] tabcontent = new String[content.size()/4][4];
		int n = 0;
		for(int i=0;i

类manById

//员工操作窗口

package Graph;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import DAO.UserDAO;
import Factory.DAOFactory;
import Factory.Flofactory;
import StoreManager.User;

public class manById_gra {
	String identity = "";
	UserDAO user = DAOFactory.getUserDAO();
	Flofactory flo = new Flofactory();
	User user1 = flo.getUser();
	public manById_gra(String identity) throws Exception{
		this.identity = identity;
		JFrame frame = new JFrame();
		frame.setTitle("个人信息");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		String[] columnNames = new String[] { "职工号", "密码", "职位","联系方式" };
		JTable table = new JTable(user.queryById(identity),columnNames);
		JScrollPane table1 = new JScrollPane(table);
        frame.add(table1,BorderLayout.CENTER);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("更改信息");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		JButton button2 = new JButton();
		button2.setText("确定");
		button2.setFont(new Font("宋体",Font.PLAIN,14));
		button2.setSize(dim2);
		JPanel panel = new JPanel(new GridLayout(1,2,10,100));
		panel.add(button1);
		panel.add(button2);
		frame.add(panel,BorderLayout.SOUTH);
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				update_gra();
				frame.setVisible(false);
			}
		});
		button2.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				frame.setVisible(false);
			}
		});
	}
	public void update_gra(){
		JFrame frame = new JFrame();
		frame.setTitle("信息更改");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		Dimension dim1 = new Dimension(300,30);
		JLabel label = new JLabel("更新后信息:");
		label.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(label,BorderLayout.NORTH);
		JPanel panel = new JPanel(new GridLayout(4,2));
		JLabel labpass = new JLabel("密码:");
		labpass.setFont(new Font("宋体",Font.PLAIN,14));
		panel.add(labpass);
		JTextField text_password = new JTextField();
		text_password.setPreferredSize(dim1);
		panel.add(text_password);;
		JLabel jphone = new JLabel();
		jphone.setText("电话:");
		jphone.setFont(new Font("宋体",Font.PLAIN,14));
		panel.add(jphone);
		JTextField text_phone = new JTextField();
		text_phone.setPreferredSize(dim1);
		panel.add(text_phone);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("更新");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		for(int i=0;i<4;i++)
		{
			panel.add(new JLabel());
		}
		frame.add(panel,BorderLayout.CENTER);
		frame.add(button1,BorderLayout.SOUTH);
		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				user1.setUserid(identity+"");
				user1.setPassword(text_password.getText());
				user1.setUserphone(text_phone.getText());
				try {
					user.update1(user1);
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				frame.setVisible(false);
				try {
					manById_gra mgra = new manById_gra(identity);
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		});
	}
}

类ordById

//顾客查询订单窗口

package Graph;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import DAO.OrdersDAO;
import Factory.DAOFactory;
import Factory.Flofactory;
import SqlExecute.SqlOrdersImpl;
import StoreManager.Orders;

public class ordById_gra {
	OrdersDAO orDao = DAOFactory.getOrdersDAO();
	Flofactory flo = new Flofactory();
	Orders ord = flo.getOrders();
	public String identity = "";
	public ordById_gra(String identity) throws Exception{
		this.identity = identity;
		List content = orDao.queryByC_Id(identity);
		JFrame frame = new JFrame();
		frame.setTitle("我的订单");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		String[][] tabcontent = new String[content.size()/5][5];
		int n = 0;
		for(int i=0;i

类orders

//店员对订单操作窗口

package Graph;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import DAO.OrdersDAO;
import Factory.DAOFactory;
import Factory.Flofactory;
import SqlExecute.SqlOrdersImpl;
import StoreManager.Flower;
import StoreManager.Orders;

public class orders_gra {
	OrdersDAO orDao = DAOFactory.getOrdersDAO();
	Flofactory flo = new Flofactory();
	Orders ord = flo.getOrders();
	public orders_gra() throws Exception{
		JFrame frame = new JFrame();
		frame.setTitle("鲜花销售系统");//设置窗体标题
		frame.setSize(600, 400);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		JLabel label = new JLabel("订单信息",JLabel.CENTER);
		label.setSize(500,50);
		String[] columnNames = new String[] { "订单编号", "顾客id", "订单信息","订单时间" ,"金额" };
		List content = orDao.queryAll();
		String[][] tabcontent = new String[content.size()/5][5];
		int n = 0;
		for(int i=0;i majorBox = new JComboBox();
		majorBox.addItem("--请选择--");
		//从数据库获取所有的专业,添加到下拉列表中
		majorBox.addItem("订单编号");
		majorBox.addItem("顾客id");
		frame.add(majorBox);
		JTextField text_name = new JTextField();
		Dimension dim1 = new Dimension(300,30);
		text_name.setPreferredSize(dim1);
		frame.add(text_name);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("查询");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		frame.add(button1);
		
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				try {
					if(majorBox.getSelectedItem().equals("订单编号"))
					{
						if(orDao.queryById(text_name.getText()))
						{
							queryId(orDao.ById);
						}
						else {
							query_loss();
						}
					}
				else if(majorBox.getSelectedItem().equals("顾客id")){
					orDao.storemessageclear();
					List content1 = orDao.queryByC_Id(text_name.getText());
					if(content1.size() == 0)
						query_loss();
					else {
						String[][] tabcontent = new String[content1.size()/4][5];
						int n = 0;
						for(int i=0;i

类register

//顾客注册窗口

package Graph;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.JobAttributes;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigInteger;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import DAO.CustomerDAO;
import DAO.FlowerDAO;
import Factory.DAOFactory;
import Factory.Flofactory;
import SqlExecute.SqlCustomerImpl;
import SqlExecute.SqlManagerImpl;
import StoreManager.Customer;
import StoreManager.User;

public class register_gra {
	CustomerDAO cusDao = DAOFactory.getCustomerDAO();
	Flofactory flo = new Flofactory();
	Customer cus = flo.getCustomer();
	public register_gra() throws Exception {
		// TODO Auto-generated constructor stub
		JFrame frame = new JFrame();
		frame.setTitle("Login");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);

		frame.setLayout(fl);
		JLabel labname = new JLabel("您的账号:");
		labname.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(labname);
		JTextField text_name = new JTextField();
		Dimension dim1 = new Dimension(300,30);
		text_name.setPreferredSize(dim1);
		frame.add(text_name);
		JLabel labpass = new JLabel("请设置密码:");
		labpass.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(labpass);
		JTextField text_password = new JTextField();
		text_password.setPreferredSize(dim1);
		frame.add(text_password);
		JLabel jphone = new JLabel();
		jphone.setText("您的电话:");
		jphone.setFont(new Font("宋体",Font.PLAIN,14));
		frame.add(jphone);
		JTextField text_phone = new JTextField();
		text_phone.setPreferredSize(dim1);
		frame.add(jphone);
		frame.add(text_phone);
		JButton button1 = new JButton();
		Dimension dim2 = new Dimension(100,30);
		button1.setText("注册");
		button1.setFont(new Font("宋体",Font.PLAIN,14));
		button1.setSize(dim2);
		frame.add(button1);
		List getId = cusDao.queryAll();
		int id = Integer.parseInt(getId.get(getId.size()-4));
		text_name.setText(id+1+"");
		text_name.setEditable(false);
		frame.setVisible(true);
		button1.addActionListener(new ActionListener() {
			@SuppressWarnings("deprecation")
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				cus.setCusid(text_name.getText());
				cus.setPassword(text_password.getText());
				cus.setCusphone(text_phone.getText());
				cus.setBalance(0.00);
				try {
					if(cusDao.insert(cus) == 1)
						RegisterSucess();
					else
						RegisterDefeat();
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				frame.setVisible(false);
			}
		});
	}
	public void RegisterSucess() {
		//设置窗体对象的属性值
		JFrame frame = new JFrame();
		frame.setTitle("Login");//设置窗体标题
		frame.setSize(400, 250);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setResizable(false);//禁止调整窗体大小
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		
		//实例化FlowLayout流式布局类的对象,指定对齐方式为居中对齐组件之间的间隔为10个像素
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);
		//实例化流式布局类的对象
		frame.setLayout(fl);
		
		//实例化JLabel标签对象,该对象显示“账号”
		JLabel lab = new JLabel("注册成功!");
		frame.add(lab);
		JButton button = new JButton();
		button.setText("确定");
		button.setSize(100,30);
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				frame.setVisible(false);
			}
		});
		frame.add(button);
		frame.setVisible(true);
	}
	
	public void RegisterDefeat() {
		JFrame frame = new JFrame();
		frame.setTitle("Login");//设置窗体标题
		frame.setSize(400, 250);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setResizable(false);//禁止调整窗体大小
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		
		//实例化FlowLayout流式布局类的对象,指定对齐方式为居中对齐组件之间的间隔为10个像素
		FlowLayout fl = new FlowLayout(FlowLayout.CENTER,10,10);
		//实例化流式布局类的对象
		frame.setLayout(fl);
		
		//实例化JLabel标签对象,该对象显示“账号”
		JLabel lab = new JLabel("注册失败!");
		frame.add(lab);
		JButton button = new JButton();
		button.setText("确定");
		button.setSize(100,30);
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				frame.setVisible(false);
			}
		});
		frame.add(button);
		frame.setVisible(true);
	}
}

类sale

//买花窗口

package Graph;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.xml.ws.soap.AddressingFeature;

import DAO.CustomerDAO;
import DAO.FlowerDAO;
import DAO.OrdersDAO;
import Factory.DAOFactory;
import SqlExecute.SqlFlowerImpl;
import SqlExecute.SqlOrdersImpl;

public class sale_gra {
	public String identity = "";
	public String datetime = "";
	List selected = new ArrayList();
	List price = new ArrayList();
	List Number = new ArrayList();
	CustomerDAO cusDao = DAOFactory.getCustomerDAO();
	OrdersDAO ordDao = DAOFactory.getOrdersDAO();
	FlowerDAO floDao = DAOFactory.getFlowerDAO();
	double pay = 0;
	String orders = "";
	public sale_gra(String identity) throws Exception {
		// TODO Auto-generated constructor stub
		this.identity = identity;
		JFrame frame = new JFrame();
		frame.setTitle("人员信息");//设置窗体标题
		frame.setSize(500, 350);//设置窗体大小,只对顶层容器生效
		frame.setDefaultCloseOperation(1);//设置窗体关闭操作,3表示关闭窗体退出程序
		frame.setLocationRelativeTo(null);//设置窗体相对于另一组间的居中位置,参数null表示窗体相对于屏幕的中央位置
		frame.setFont(new Font("宋体",Font.PLAIN,14));//设置字体,显示格式正常,大小
		JLabel label = new JLabel("请选择花种:");
		List content = floDao.queryComBox();
		int row = (int) Math.ceil(content.size()/2.0);
		JPanel panel = new JPanel(new GridLayout(row,4));
		panel.setBorder(BorderFactory.createTitledBorder("花种:"));
		List radioButtons = new ArrayList();
		List textFields = new ArrayList();
		for(int i=0;i

你可能感兴趣的:(销售系统,mysql,java,eclipse)