基于java+mysql的swing+mysql药品管理系统(java+swing+gui+mysql)

基于java+mysql的swing+mysql药品管理系统(java+swing+gui+mysql)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于java+mysql的Swing+MySQL药品管理系统(java+swing+gui+mysql)

功能介绍:用户管理、药品库存管理、进销管理、营销管理、药品购入、药品售出、药市信息

		public void actionPerformed(ActionEvent e) {
			JButton btton = (JButton) e.getSource();
			if (btton.equals(cancelBtn)) {
				RegiestView.this.dispose();
			}else{
				doRegiest();
			}
					
		}
		
	}
}

public class AddMedicineView extends JFrame {
		
		private Medicine smv;

		private JPanel centerJpanel = new JPanel(){
			public void paintComponent(Graphics g){
				super.paintComponent(g);
				ImageIcon icon=new ImageIcon("E:\\图片册\\pu.jpg");
				int width=centerJpanel.getWidth();
		public void buildUi() {
			setLayout(new BorderLayout(20, 20));
			centerJpanel.setLayout(new GridLayout(8, 2));
			centerJpanel.add(medicineIdJLabel);
			centerJpanel.add(medicineIdJTexFed);
			centerJpanel.add(medicinenameJLabel);
			centerJpanel.add(medicinenameJTexFed);
			centerJpanel.add(medicinepriceJLabel);
			centerJpanel.add(medicinepriceJTexFed);
			centerJpanel.add(medicineamountsJLabel);
			centerJpanel.add(medicineamountsJTexFed);
			centerJpanel.add(medicineproducerJLabel);
			centerJpanel.add(medicinproducerJTexFed);
			add(centerJpanel,BorderLayout.CENTER);
			southJpanel = new JPanel();
			cancelBtn = new JButton("取消");
			cancelBtn.setSize(100, 60);
			southJpanel.add(cancelBtn);
			cancelBtn.addActionListener(new A());
			confirmBtn = new JButton("确认");
			confirmBtn.setSize(100, 60);
			southJpanel.add(confirmBtn);
			confirmBtn.addActionListener(new A());
			add(southJpanel,BorderLayout.SOUTH);
		
		}
		public void doConfirm(){
			String meid = medicineIdJTexFed.getText().trim();
			String mename = medicinenameJTexFed.getText().trim();
			String meprice = medicinepriceJTexFed.getText().trim();
			
			int meamounts = Integer.parseInt(medicineamountsJTexFed.getText().trim());
			
			String meproducer=medicinproducerJTexFed.getText().trim();
			String sql = "insert into medicine(meid,mename,meprice,meamounts,"
					+ "meproducer)values(?,?,?,?,?)";
			SqlHelper sqlHelper = new SqlHelper();
			String paras [] = {meid,mename,meprice,meamounts+"",
					meproducer};
			boolean issuccess = sqlHelper.update(sql, paras);
			if (issuccess) {
        add(bottomAllJpane, BorderLayout.SOUTH);

        newButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                AddEmployeeView aev = new AddEmployeeView(EmployeeManagerView.this);

            }
        });

        deleteButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
//				deleteEmployee();
                comfirmDelete();
            }
        });
        updateButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                int selectIndex = empJtable.getSelectedRow();
                if (selectIndex == -1) {
                    JOptionPane.showConfirmDialog(null, "请先选中一行", "提示", JOptionPane.WARNING_MESSAGE);

                } else {
                    Object[] row = datas.get(selectIndex);
                    String eid = (String) row[0];

                    new UpdateEmployeeView(eid, EmployeeManagerView.this);
                }

            }
        });

        topJpanel.add(filterUserNameJLable);
        filterUserNameJLable.setFont(new Font("Dialog", 1, 13));
        topJpanel.add(filterUsernameJTexfd);
        topJpanel.add(isAdminJLabel);
        isAdminJLabel.setFont(new Font("Dialog", 1, 13));
        topJpanel.add(isAdminJTexfd);
        topJpanel.add(searchBtn);
        searchBtn.setFont(new Font("Dialog", 1, 13));
        searchBtn.setBackground(Color.green);
		private JLabel filterMedicineNameJLable = new JLabel("药品id/药品名称");
		private JTextField filterMedicineNameJTexfd = new JTextField(12);
		private JLabel medicineproducerJLabel = new JLabel("生产商");
		private JTextField medicinproducerJTexFed = new JTextField(12);
		private JButton searchBtn = new JButton("查找");
		private ArrayList<Object[]> datas = null;

		public Medicine() {
			setLayout(new BorderLayout());
			add(centerJscrollPane, BorderLayout.CENTER);
			
			dtm1.addColumn("药品id");
			dtm1.addColumn("药品名称");
			dtm1.addColumn("药品价格");
			dtm1.addColumn("入库日期");
			dtm1.addColumn("库存量");
			dtm1.addColumn("生产商");

			refreshJTable();
			newButton = new JButton("新增药品");
			newButton.setBackground(Color.green);
			newButton.setFont(new Font("Dialog",1,15));
			updateButton = new JButton("修改药品");
			updateButton.setBackground(Color.green);
			updateButton.setFont(new Font("Dialog",1,15));
			deleteButton = new JButton("坏药移除");
			deleteButton.setBackground(Color.green);
			deleteButton.setFont(new Font("Dialog",1,15));
			bottomJpanel.add(newButton);
			bottomJpanel.add(updateButton);
			bottomJpanel.add(deleteButton);
			bottomJpanel .setPreferredSize(new Dimension(900,50));
			add(bottomJpanel, BorderLayout.SOUTH);
			newButton.addActionListener(new ActionListener() {

				@Override
				public void actionPerformed(ActionEvent e) {
					@SuppressWarnings("unused")
					AddMedicineView aea = new AddMedicineView(Medicine.this);

				}
			});
			deleteButton.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent e) {
//					deleteEmployee();
					comfirmDelete();
				}
			});
			 updateButton.addActionListener(new ActionListener() {
					
					@Override
    public void close() {
        try {
            if (rs != null) {
                rs.close();
            }

            if (ps != null) {
                ps.close();
            }

            if (ct != null) {
                ct.close();
            }

        } catch (Exception e) {

            e.printStackTrace();
        }
    }

    // []paras,通过?赋值方式可以防止漏洞注入方式,保证安全性
    public ResultSet query(String sql, String[] paras) {
        try {
            ps = ct.prepareStatement(sql);
            // 对sql的参数赋值
            for (int i = 0; i < paras.length; i++) {
                ps.setString(i + 1, paras[i]);
            }
            // 执行查询
            rs = ps.executeQuery();
        } catch (Exception e) {
            e.printStackTrace();
        }
        // 返回结果集
        return rs;
    }

    // 增删改方法
    public boolean update(String sql, String[] paras) {

        boolean b = true;
        try {

            ps = ct.prepareStatement(sql);
            // 循环的对paras赋值,?赋值法
			add(bottomAllJpane, BorderLayout.SOUTH);
		
		}
		public void doConfirm(){
			String movid = medicineIdJTexFed.getText().trim();
			String movname = medicinenameJTexFed.getText().trim();
			int movoutprice = Integer.parseInt(medicineoutpriceJTexFed.getText().trim());
		
			int movoutamounts = Integer.parseInt(medicineoutamountsJTexFed.getText().trim());
			int movincomes = Integer.parseInt(medicineincomesJTexFed.getText().trim());
			
			String mvlogindate=medicinelogindateJTexFed.getText().trim();
			String sql = "insert into marketoutview(movid,movname,movoutprice,movoutamounts,movincomes,"
					+ "mvlogindate)values(?,?,?,?,?,?)";
			SqlHelper sqlHelper = new SqlHelper();
			String paras [] = {movid,movname,movoutprice+"",movoutamounts+"",movincomes+"",
					mvlogindate};
			boolean issuccess = sqlHelper.update(sql, paras);
			if (issuccess) {
				JOptionPane.showConfirmDialog(null, 
						"卖出成功","提示",JOptionPane.CLOSED_OPTION);
				arel.refreshoutJTable();
				this.dispose();
			}else{
				JOptionPane.showConfirmDialog(null, "卖出失败","提示",JOptionPane.WARNING_MESSAGE);
			}
		}
		class A implements ActionListener{
			@Override
			public void actionPerformed(ActionEvent e) {
				JButton btton = (JButton) e.getSource();
				if (btton.equals(cancelBtn)) {
					MarketOutRecords.this.dispose();
				}else{
					doConfirm();
				}
			}
			
		}	
}

		        } 
		};
		private JPanel southJpanel;
		private JButton cancelBtn;
		private JButton confirmBtn;
		
		public MarketOutRecords(MarketView arel) {
			this.arel = arel;
			setTitle("售货记录");

			buildUi();

			setSize(400, 270);
			setLocationRelativeTo(null);
			setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			setVisible(true);
		}
		public void buildUi() {
			setLayout(new BorderLayout(20, 20));
			centerJpanel.setPreferredSize(new Dimension(400,170));
			centerJpanel.setLayout(new GridLayout(3, 2));
			
			
			centerJpanel.add(medicineIdJLabel);
			medicineIdJLabel.setFont(new Font("Dialog",1,15));
			centerJpanel.add(medicineIdJTexFed);
			centerJpanel.add(medicinenameJLabel);
			medicinenameJLabel.setFont(new Font("Dialog",1,15));
			centerJpanel.add(medicinenameJTexFed);
			centerJpanel.add(medicinelogindateJLabel);
			medicinelogindateJLabel.setFont(new Font("Dialog",1,15));
			centerJpanel.add(medicinelogindateJTexFed);
			add(centerJpanel,BorderLayout.CENTER);
			
			bottomAllJpane.setLayout(new BorderLayout());
			bottomAllJpane.setPreferredSize(new Dimension(400,100));
			
			bottomAllJpane.add(bottonPageJpanel, BorderLayout.CENTER);
			bottonPageJpanel.add(medicineoutpriceJLabel);
			medicineoutpriceJLabel.setFont(new Font("Dialog",1,15));
			bottonPageJpanel.add(medicineoutpriceJTexFed);
			bottonPageJpanel.add(medicineoutamountsJLabel);
			medicineoutamountsJLabel.setFont(new Font("Dialog",1,15));
			bottonPageJpanel.add(medicineoutamountsJTexFed);
			bottonPageJpanel.add(medicineincomesJLabel);
			medicineincomesJLabel.setFont(new Font("Dialog",1,15));
			bottonPageJpanel.add(medicineincomesJTexFed);
			
			southJpanel = new JPanel(){
				public void paintComponent(Graphics g) {  
			        super.paintComponent(g);  
			        ImageIcon icon;  
	private JButton regiestBtn;
	
	public AddEmployeeView(EmployeeManagerView smv) {
		this.smv = smv;
		
		setTitle("添加界面");
       
		buildUi();

		setSize(400, 300);
		setLocationRelativeTo(null);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
	}

	/**
	 */
	public void buildUi() {
		setLayout(new BorderLayout(20, 20));
		centerJpanel.setLayout(new GridLayout(9, 2));
		centerJpanel.add(userIdJLabel);
		centerJpanel.add(userIdJTexFed);
		centerJpanel.add(passwordJLabel);
		centerJpanel.add(passwordJTexFed);
		centerJpanel.add(userNameJLabel);
		centerJpanel.add(userNameJTexFed);
		centerJpanel.add(sexJLabel);
		centerJpanel.add(sexJcomBox);
		centerJpanel.add(ageJLabel);
		centerJpanel.add(ageJTexFed);
		centerJpanel.add(isAdminJLabel);
		centerJpanel.add(isAdminJcomBox);
		
		add(centerJpanel,BorderLayout.CENTER);
		southJpanel = new JPanel();
		cancelBtn = new JButton("取消");
		cancelBtn.setBackground(Color.lightGray);
		cancelBtn.setSize(100, 60);
		southJpanel.add(cancelBtn);
		cancelBtn.addActionListener(new A());
		regiestBtn = new JButton("注册");
		regiestBtn.setBackground(Color.lightGray);
                rows[1] = result.getString(2);
                rows[2] = result.getString(3);
                rows[3] = result.getString(4);
                rows[4] = result.getString(5);
                rows[5] = result.getString(6);

                marketoutviews.add(rows);
            }

        } else {
            JOptionPane.showConfirmDialog(null, "没有查询到相关记录", "提示", JOptionPane.WARNING_MESSAGE);

        }
        return marketoutviews;
    }

    public void refreshinJTable() {
        dtm2.setNumRows(0);
        try {
            datas = getinViewByDb();
            for (int i = 0; i < datas.size(); i++) {
                dtm2.addRow(datas.get(i));
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }

    }

    public void refreshoutJTable() {
        dtm3.setNumRows(0);
        try {
            datas = getoutViewByDb();
            for (int i = 0; i < datas.size(); i++) {
                dtm3.addRow(datas.get(i));
            }

        } catch (SQLException e) {
			};
			cancelBtn = new JButton("取消");
			cancelBtn.setBackground(Color.lightGray);
			cancelBtn.setSize(100, 60);
			southJpanel.add(cancelBtn);
			cancelBtn.addActionListener(new A());
			confirmBtn = new JButton("确认");
			confirmBtn.setBackground(Color.lightGray);
			confirmBtn.setSize(100, 60);
			southJpanel.add(confirmBtn);
			confirmBtn.addActionListener(new A());
			add(southJpanel,BorderLayout.SOUTH);
			southJpanel.setPreferredSize(new Dimension(800,35));
			bottomAllJpane.add(southJpanel, BorderLayout.SOUTH);
			
			add(bottomAllJpane, BorderLayout.SOUTH);
		
		}
		public void doConfirm(){
			String movid = medicineIdJTexFed.getText().trim();
			String movname = medicinenameJTexFed.getText().trim();
			int movoutprice = Integer.parseInt(medicineoutpriceJTexFed.getText().trim());
		
			int movoutamounts = Integer.parseInt(medicineoutamountsJTexFed.getText().trim());
			int movincomes = Integer.parseInt(medicineincomesJTexFed.getText().trim());
			
			String mvlogindate=medicinelogindateJTexFed.getText().trim();
			String sql = "insert into marketoutview(movid,movname,movoutprice,movoutamounts,movincomes,"
					+ "mvlogindate)values(?,?,?,?,?,?)";
			SqlHelper sqlHelper = new SqlHelper();
			String paras [] = {movid,movname,movoutprice+"",movoutamounts+"",movincomes+"",
					mvlogindate};
			boolean issuccess = sqlHelper.update(sql, paras);
			if (issuccess) {
				JOptionPane.showConfirmDialog(null, 
						"卖出成功","提示",JOptionPane.CLOSED_OPTION);
				arel.refreshoutJTable();
				this.dispose();
			}else{
				JOptionPane.showConfirmDialog(null, "卖出失败","提示",JOptionPane.WARNING_MESSAGE);
			}
		}

		private JLabel medicinepriceJLabel = new JLabel("药品价格:");
		private JTextField medicinepriceJTexFed = new JTextField();;

		
		private JLabel medicineamountsJLabel = new JLabel("库存量:  ");
		private JTextField medicineamountsJTexFed = new JTextField();;

		private JLabel medicineproducerJLabel = new JLabel("生产商:  ");
		private JTextField medicinproducerJTexFed = new JTextField();;
        
		private JPanel southJpanel;
		private JButton cancelBtn;
		private JButton confirmBtn;
		
		public AddMedicineView(Medicine smv) {
			this.smv = smv;
			setTitle("药品添加界面");

			buildUi();

			setSize(300, 300);
			setLocationRelativeTo(null);
			setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			setVisible(true);
		}
		public void buildUi() {
			setLayout(new BorderLayout(20, 20));
			centerJpanel.setLayout(new GridLayout(8, 2));
			centerJpanel.add(medicineIdJLabel);
			centerJpanel.add(medicineIdJTexFed);
			centerJpanel.add(medicinenameJLabel);
			centerJpanel.add(medicinenameJTexFed);
			centerJpanel.add(medicinepriceJLabel);
			centerJpanel.add(medicinepriceJTexFed);
			centerJpanel.add(medicineamountsJLabel);
			centerJpanel.add(medicineamountsJTexFed);
			centerJpanel.add(medicineproducerJLabel);
			centerJpanel.add(medicinproducerJTexFed);
			add(centerJpanel,BorderLayout.CENTER);
			southJpanel = new JPanel();
			cancelBtn = new JButton("取消");
			cancelBtn.setSize(100, 60);
			southJpanel.add(cancelBtn);
			cancelBtn.addActionListener(new A());
			confirmBtn = new JButton("确认");
			confirmBtn.setSize(100, 60);
			southJpanel.add(confirmBtn);
			confirmBtn.addActionListener(new A());
			add(southJpanel,BorderLayout.SOUTH);
		
		}
		public void doConfirm(){
	private JLabel sexJLabel = new JLabel("性别:");
	private String sexvalue[] = { "女", "男" };
	private JComboBox sexJcomBox = new JComboBox(sexvalue);

	
	private JLabel ageJLabel = new JLabel("年龄:");
	private JTextField ageJTexFed = new JTextField();;

	
	private JLabel isAdminJLabel = new JLabel("是否管理员");
	
	private String isAdminvalue[] = { "普通员工", "管理员" };
	private JComboBox isAdminJcomBox = new JComboBox(isAdminvalue);

	
	private JPanel southJpanel;
	private JButton cancelBtn;
	private JButton regiestBtn;
	
	public AddEmployeeView(EmployeeManagerView smv) {
		this.smv = smv;
		
		setTitle("添加界面");
       
		buildUi();

		setSize(400, 300);
		setLocationRelativeTo(null);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setVisible(true);
	}

	/**
	 */
	public void buildUi() {
		setLayout(new BorderLayout(20, 20));
		centerJpanel.setLayout(new GridLayout(9, 2));
		centerJpanel.add(userIdJLabel);
		centerJpanel.add(userIdJTexFed);
		centerJpanel.add(passwordJLabel);
		centerJpanel.add(passwordJTexFed);
		centerJpanel.add(userNameJLabel);
		centerJpanel.add(userNameJTexFed);
		centerJpanel.add(sexJLabel);
		centerJpanel.add(sexJcomBox);
		centerJpanel.add(ageJLabel);
		centerJpanel.add(ageJTexFed);
		centerJpanel.add(isAdminJLabel);
		centerJpanel.add(isAdminJcomBox);
		

public class AddMedicineView extends JFrame {
		
		private Medicine smv;

		private JPanel centerJpanel = new JPanel(){
			public void paintComponent(Graphics g){
				super.paintComponent(g);
				ImageIcon icon=new ImageIcon("E:\\图片册\\pu.jpg");
				int width=centerJpanel.getWidth();
				int heigh=centerJpanel.getHeight();
				g.drawImage(icon.getImage(), 0, 0, width,heigh,null);
			}
		};

		private JLabel medicineIdJLabel = new JLabel("药品编号:");
		private JTextField medicineIdJTexFed = new JTextField();

		private JLabel medicinenameJLabel = new JLabel("药品名称:");
		private JTextField medicinenameJTexFed = new JTextField();;

		private JLabel medicinepriceJLabel = new JLabel("药品价格:");
		private JTextField medicinepriceJTexFed = new JTextField();;

		
		private JLabel medicineamountsJLabel = new JLabel("库存量:  ");
		private JTextField medicineamountsJTexFed = new JTextField();;

		private JLabel medicineproducerJLabel = new JLabel("生产商:  ");
		private JTextField medicinproducerJTexFed = new JTextField();;
        
		private JPanel southJpanel;
		private JButton cancelBtn;
		private JButton confirmBtn;
		
		public AddMedicineView(Medicine smv) {
			this.smv = smv;
			setTitle("药品添加界面");

			buildUi();

			setSize(300, 300);
			setLocationRelativeTo(null);
			setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			setVisible(true);
		}

            }
        });

        topJpanel.add(filterUserNameJLable);
        filterUserNameJLable.setFont(new Font("Dialog", 1, 13));
        topJpanel.add(filterUsernameJTexfd);
        topJpanel.add(isAdminJLabel);
        isAdminJLabel.setFont(new Font("Dialog", 1, 13));
        topJpanel.add(isAdminJTexfd);
        topJpanel.add(searchBtn);
        searchBtn.setFont(new Font("Dialog", 1, 13));
        searchBtn.setBackground(Color.green);
        add(topJpanel, BorderLayout.NORTH);
        searchBtn.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                getFilter();

            }
        });

        pageCount = dataSum / pageSize;
        if (dataSum % pageSize > 0) {
            pageCount++;
        }
        refreshJTable(currntPage + 1, pageSize);

    }

    /**
     * 查找所有员工
     *
     * @return
     * @throws SQLException
     */
    private ArrayList<Object[]> getEmployeesByDb(int begin, int size) throws SQLException {
        ArrayList<Object[]> employeeslist = new ArrayList<Object[]>();
        // 查询sql语句
        String sql = "select * from EmployeeInfo limit " + begin + "," + size + "";
        // 查询数据
        ResultSet result = new SqlHelper().query(sql, new String[]{});
        if (result != null) {
            while (result.next()) {
                Object rows[] = new Object[6];

	public class UpdateMedicineView extends JFrame {
		
		private Medicine smv;
		private String eId;

		private JPanel centerJpanel = new JPanel(){
			public void paintComponent(Graphics g){
				super.paintComponent(g);
				ImageIcon icon=new ImageIcon("E:\\图片册\\pu.jpg");
				int width=centerJpanel.getWidth();
				int heigh=centerJpanel.getHeight();
				g.drawImage(icon.getImage(), 0, 0, width,heigh,null);
			}
		};

		private JLabel medicineIdJLabel = new JLabel("药品编号:");
		private JTextField medicineIdJTexFed = new JTextField();

		private JLabel medicinenameJLabel = new JLabel("药品名称:");
		private JTextField medicinenameJTexFed = new JTextField();;

		private JLabel medicinepriceJLabel = new JLabel("药品价格:");
		private JTextField medicinepriceJTexFed = new JTextField();;
        
		
		private JLabel medicineamountsJLabel = new JLabel("库存量:");
		private JTextField medicineamountsJTexFed = new JTextField();;
		
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            ImageIcon icon;
            Image img;
            icon = new ImageIcon("E:\\图片册\\pu.jpg");// 背景图片
            img = icon.getImage();
            g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
        }
    };
    private JLabel meLabel = new JLabel("     ");

    ImageIcon icon = new ImageIcon("E:\\图片册\\yin.jpg");

    private ArrayList<Object[]> datas = null;

    public MarketView() {
        bottomAllJpane.setLayout(new BorderLayout());
        bottomAllJpane.setPreferredSize(new Dimension(900, 320));
        bottomAllJpane.add(centerJscrollPane1, BorderLayout.WEST);
        centerJscrollPane1.setPreferredSize(new Dimension(385, 300));
        bottomAllJpane.add(centerJscrollPane2, BorderLayout.CENTER);
        centerJscrollPane2.setPreferredSize(new Dimension(385, 300));
        dtm2.addColumn("药品id");
        dtm2.addColumn("药品名称");
        dtm2.addColumn("批发价");
        dtm2.addColumn("批发量");
        dtm2.addColumn("成本");
        dtm2.addColumn("货源");
        refreshinJTable();

        dtm3.addColumn("药品id");
        dtm3.addColumn("药品名称");
        dtm3.addColumn("卖出价");
        dtm3.addColumn("卖出量");
        dtm3.addColumn("赚得金额");
        dtm3.addColumn("登记日期");
        refreshoutJTable();

        newButton = new JButton("药品购入", icon);
        newButton.setHorizontalTextPosition(SwingConstants.CENTER);
        newButton.setBackground(Color.green);
        newButton.setBounds(12, 50, 100, 60);
        newButton.setFont(new Font("Dialog", 1, 15));
        deleteButton = new JButton("药品售出", icon);
        deleteButton.setHorizontalTextPosition(SwingConstants.CENTER);
        deleteButton.setBackground(Color.green);
				+ "age,isAdmin)values(?,?,?,?,?,?)";
		SqlHelper sqlHelper = new SqlHelper();
		String paras [] = {eid,password,ename,sex+"",
				age+"",isAdmin+""};
		boolean issuccess = sqlHelper.update(sql, paras);
		if (issuccess) {
			JOptionPane.showConfirmDialog(null, 
					"添加成功","提示",JOptionPane.CLOSED_OPTION);
			smv.refreshJTable(1,8);
			this.dispose();
		}else{
			JOptionPane.showConfirmDialog(null, "添加失败","提示",JOptionPane.WARNING_MESSAGE);
		}
	}
	
//	public static void main(String[] args) {
//		new RegiestView();
//	}
	
	class A implements ActionListener{
		@Override
		public void actionPerformed(ActionEvent e) {
			JButton btton = (JButton) e.getSource();
			if (btton.equals(cancelBtn)) {
				AddEmployeeView.this.dispose();
			}else{
				doRegiest();
			}
		}
		
	}
}

        pageInfoLagel = new JLabel(" ");
        pageInfoLagel.setOpaque(true);
        pageInfoLagel.setFont(new Font("Dialog", 1, 18));

        bottonPageJpanel.add(firstButton);
        bottonPageJpanel.add(preButton);
        bottonPageJpanel.add(nextButton);
        bottonPageJpanel.add(lastButton);
        bottonPageJpanel.add(pageInfoLagel);
        firstButton.addActionListener(new PageClick());
        lastButton.addActionListener(new PageClick());
        preButton.addActionListener(new PageClick());
        nextButton.addActionListener(new PageClick());
        //refreshJTable();

        newButton = new JButton("新增用户");
        newButton.setBackground(Color.green);
        newButton.setFont(new Font("Dialog", 1, 15));
        updateButton = new JButton("修改用户");
        updateButton.setBackground(Color.green);
        updateButton.setFont(new Font("Dialog", 1, 15));
        deleteButton = new JButton("删除用户");
        deleteButton.setBackground(Color.green);
        deleteButton.setFont(new Font("Dialog", 1, 15));
        bottomJpanel.add(newButton);
        bottomJpanel.add(updateButton);
        bottomJpanel.add(deleteButton);
        bottomJpanel.setPreferredSize(new Dimension(900, 80));
        bottomAllJpane.add(bottomJpanel, BorderLayout.SOUTH);

        add(bottomAllJpane, BorderLayout.SOUTH);

        newButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                AddEmployeeView aev = new AddEmployeeView(EmployeeManagerView.this);

            }
        });

        deleteButton.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
//				deleteEmployee();
                comfirmDelete();
            }
        });
        updateButton.addActionListener(new ActionListener() {

            @Override

请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值