ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Eclipse+Java+Swing+Mysql实现网上订餐系统【建议收藏】

2021-10-14 18:58:30  阅读:316  来源: 互联网

标签:Java java GroupLayout Swing Eclipse private swing new javax


目录

一、系统介绍

1.开发环境

2.技术选型

3.系统功能

4.数据库

二、系统展示

1.登录系统

2.用户-注册系统

3.用户-主界面

4.用户-用户点餐

5.用户-查询订单

6.用户-修改密码

7.管理员-主界面

8.管理员-新增套餐

9.管理员-维护套餐

10.管理员-订单管理

三、部分代码

LogOnFrm.java

RegisterFrm.java

AdminFrm.java

UserOrderFrm.java

AccountModifyInterFrm.java

 四、其他

1.其他系统实现

1.JavaWeb系统系列实现

2.JavaSwing系统系列实现

2.获取源码

3.运行项目

4.备注

5.支持博主


 

JavaSwing系统系列实现系列

Java+Swing实现斗地主游戏

Java+Swingl实现电影购票系统

Java+Swing实现图书管理系统

Java+Swing实现医院管理系统

Java+Swing实现考试管理系统

Java+Swing实现仓库管理系统-1

Java+Swing实现仓库管理系统-2

Java+Swing实现自助取款机系统

Java+Swing实现通讯录管理系统

Java+Swing实现停车场管理系统

Java+Swing实现学生信息管理系统

Java+Swing实现学生宿舍管理系统

Java+Swing实现学生选课管理系统

Java+Swing实现学生成绩管理系统

Java+Swing实现学校教材管理系统

Java+Swing实现学校教务管理系统

Java+Swing实现企业人事管理系统

Java+Swing实现电子相册管理系统

Java+Swing实现超市管理系统-TXT存储数据

Java+Swing实现自助取款机系统-TXT存储数据

Java+Swing实现宠物商店管理系统-TXT存储数据

一、系统介绍

1.开发环境

开发工具:Eclipse2021

JDK版本:jdk1.8

Mysql版本:8.0.13

2.技术选型

Java+Swing+Mysql

3.系统功能

用户

1.登录系统

2.注册系统

3.用户点餐

4.查询订单

5.修改密码

管理员

1.登录系统

2.新增套餐

3.维护套餐

4.订单管理

4.数据库

/*
 Navicat Premium Data Transfer

 Source Server         : MYSQL
 Source Server Type    : MySQL
 Source Server Version : 80013
 Source Host           : localhost:3306
 Source Schema         : swing_order_meal

 Target Server Type    : MySQL
 Target Server Version : 80013
 File Encoding         : 65001

 Date: 14/10/2021 16:35:40
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for goods
-- ----------------------------
DROP TABLE IF EXISTS `goods`;
CREATE TABLE `goods`  (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `goodsName` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `price` float NULL DEFAULT NULL,
  `goodsDesc` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `imageLink` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of goods
-- ----------------------------
INSERT INTO `goods` VALUES (1, '碳烤鸡肉寿司', 23.1, '鸡肉、生菜、海苔、寿司', 'E:\\codes\\BusinessCodes\\JavaSwing\\OrderMeal\\src\\images\\ss1.png');
INSERT INTO `goods` VALUES (2, '北海道寿司', 13.2, '鱼、甜辣酱、海苔、米饭', 'E:\\codes\\BusinessCodes\\JavaSwing\\OrderMeal\\src\\images\\ss2.png');
INSERT INTO `goods` VALUES (3, '鳗鱼爆浆寿司', 43.2, '鱼、甜辣酱、海苔、米饭', 'E:\\codes\\BusinessCodes\\JavaSwing\\OrderMeal\\src\\images\\ss4.png');

-- ----------------------------
-- Table structure for order_goods
-- ----------------------------
DROP TABLE IF EXISTS `order_goods`;
CREATE TABLE `order_goods`  (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `orderId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `goodsTotalPrice` float NULL DEFAULT NULL,
  `goodsId` int(10) NULL DEFAULT NULL,
  `goodsPrice` float NULL DEFAULT NULL,
  `goodsNum` int(10) NULL DEFAULT NULL,
  `goodsName` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `FK_order_goods_2`(`orderId`) USING BTREE,
  INDEX `FK_order_goods_1`(`goodsId`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of order_goods
-- ----------------------------
INSERT INTO `order_goods` VALUES (44, '20190319141543', 43.2, 3, 43.2, 1, '鳗鱼爆浆寿司');
INSERT INTO `order_goods` VALUES (45, '20190319141543', 13.2, 2, 13.2, 1, '北海道寿司');
INSERT INTO `order_goods` VALUES (46, '20211014114920', 23.1, 1, 23.1, 1, '碳烤鸡肉寿司');
INSERT INTO `order_goods` VALUES (47, '20211014161704', 23.1, 1, 23.1, 1, '碳烤鸡肉寿司');
INSERT INTO `order_goods` VALUES (48, '20211014162614', 13.2, 2, 13.2, 1, '北海道寿司');

-- ----------------------------
-- Table structure for order_info
-- ----------------------------
DROP TABLE IF EXISTS `order_info`;
CREATE TABLE `order_info`  (
  `orderId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `orderStatus` int(10) NULL DEFAULT NULL,
  `orderNum` int(10) NULL DEFAULT NULL,
  `orderTotalMoney` float NULL DEFAULT NULL,
  `userName` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`orderId`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of order_info
-- ----------------------------
INSERT INTO `order_info` VALUES ('20211014114920', 3, 1, 23.1, '1');
INSERT INTO `order_info` VALUES ('20211014161704', 3, 1, 23.1, 'user');
INSERT INTO `order_info` VALUES ('20211014162614', 0, 1, 13.2, 'user');

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user`  (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `userName` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `email` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  `rank` int(1) NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES (1, 'admin', 'admin', NULL, 1);
INSERT INTO `user` VALUES (11, 'user', 'user', '121232131@qq.com', 0);

SET FOREIGN_KEY_CHECKS = 1;

二、系统展示

1.登录系统

2.用户-注册系统

3.用户-主界面

4.用户-用户点餐

5.用户-查询订单

6.用户-修改密码

7.管理员-主界面

8.管理员-新增套餐

9.管理员-维护套餐

10.管理员-订单管理

三、部分代码

LogOnFrm.java

/*
 * LogOnFrm.java
 *
 * Created on __DATE__, __TIME__
 */

package com.sjsq.client;

import java.awt.Color;
import java.awt.Font;
import java.sql.Connection;

import javax.swing.JOptionPane;
import javax.swing.UIManager;

import com.sjsq.common.User;
import com.sjsq.server.UserDao;
import com.sjsq.utils.DbUtil;
import com.sjsq.utils.StringUtil;

/**
 * 用户登陆
 * 
 * @author __USER__
 */
public class LogOnFrm extends javax.swing.JFrame {

	DbUtil dbUtil = new DbUtil();
	UserDao userDao = new UserDao();
	public static User s_currentUser = null;// 保存登陆用户的参数

	/** Creates new form LogOnFrm */
	public LogOnFrm() {
		// 改变系统默认字体
		Font font = new Font("Dialog", Font.PLAIN, 12);
		java.util.Enumeration keys = UIManager.getDefaults().keys();
		while (keys.hasMoreElements()) {
			Object key = keys.nextElement();
			Object value = UIManager.get(key);
			if (value instanceof javax.swing.plaf.FontUIResource) {
				UIManager.put(key, font);
			}
		}
		initComponents();
		// 设置frame居中显示
		this.setLocationRelativeTo(null);
	}

	// GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		jLabel2 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jb_logon = new javax.swing.JButton();
		jb_register = new javax.swing.JButton();
		userNameTxt = new javax.swing.JTextField();
		passwordTxt = new javax.swing.JPasswordField();
		jb_reset = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("网上订餐系统");
		setResizable(false);

		jLabel1.setFont(new java.awt.Font("宋体", 1, 24));
		jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/OrderMeal.png"))); // NOI18N
		jLabel1.setText("餐厅点餐系统欢迎您");

		jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/userName.png"))); // NOI18N
		jLabel2.setText("用户名:");

		jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/password.png"))); // NOI18N
		jLabel3.setText("密   码:");

		jb_logon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/login.png"))); // NOI18N
		jb_logon.setText("登录");
		jb_logon.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jb_logonActionPerformed(evt);
			}
		});

		jb_register.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/register.png"))); // NOI18N
		jb_register.setText("注册");
		jb_register.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jb_registerActionPerformed(evt);
			}
		});

		jb_reset.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/reset.png"))); // NOI18N
		jb_reset.setText("重置");
		jb_reset.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jb_resetActionPerformed(evt);
			}
		});
		setBackground(Color.WHITE);
		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
				javax.swing.GroupLayout.Alignment.TRAILING,
				layout.createSequentialGroup().addGap(52, 52, 52).addGroup(layout
						.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(layout.createSequentialGroup()
								.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
										.addComponent(jLabel2).addComponent(jLabel3))
								.addGap(33, 33, 33)
								.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
										.addComponent(passwordTxt).addComponent(userNameTxt,
												javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)))
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addGroup(
								javax.swing.GroupLayout.Alignment.LEADING,
								layout.createSequentialGroup().addGap(8, 8, 8).addComponent(jb_logon).addGap(18, 18, 18)
										.addComponent(jb_reset).addGap(18, 18, 18).addComponent(jb_register))
								.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 304,
										javax.swing.GroupLayout.PREFERRED_SIZE)))
						.addContainerGap(54, Short.MAX_VALUE)));
		layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout
				.createSequentialGroup().addGap(18, 18, 18)
				.addComponent(
						jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
				.addGap(27, 27, 27)
				.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2)
						.addComponent(userNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
				.addGap(38, 38, 38)
				.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel3)
						.addComponent(passwordTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
				.addGap(37, 37, 37).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
						.addComponent(jb_logon).addComponent(jb_reset).addComponent(jb_register))
				.addContainerGap(55, Short.MAX_VALUE)));

		pack();
	}// </editor-fold>
		// GEN-END:initComponents

	// 显示注册页面
	private void jb_registerActionPerformed(java.awt.event.ActionEvent evt) {
		this.dispose();
		new RegisterFrm().setVisible(true);
	}

	// 登陆验证显示登陆以后界面
	private void jb_logonActionPerformed(java.awt.event.ActionEvent evt) {
		String userName = this.userNameTxt.getText();
		String password = new String(this.passwordTxt.getPassword());
		if (StringUtil.isEmpty(userName)) {
			JOptionPane.showMessageDialog(null, "用户名不能为空");
			return;
		}
		if (StringUtil.isEmpty(password)) {
			JOptionPane.showMessageDialog(null, "密码不能为空");
			return;
		}
		User user = new User(userName, password);
		Connection con = null;
		try {
			con = dbUtil.getCon();
			User currentUser = userDao.login(con, user);
			if (currentUser != null) {
				s_currentUser = currentUser;// 保存登陆的用户
				int role = currentUser.getRank();
				if (role == 1) {
					this.dispose();
					new AdminFrm().setVisible(true);// 进入管理员页面
				} else if (role == 0) {
					this.dispose();
					new UserOrderFrm().setVisible(true);// 进入用户点餐界面
				}
			} else {
				JOptionPane.showMessageDialog(null, "用户名或密码错误");
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "用户名或密码错误");
		} finally {
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

	}

	// 重置文本框内容
	private void jb_resetActionPerformed(java.awt.event.ActionEvent evt) {
		this.passwordTxt.setText("");
		this.userNameTxt.setText("");
	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new LogOnFrm().setVisible(true);
			}
		});
	}

	// GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JButton jb_logon;
	private javax.swing.JButton jb_register;
	private javax.swing.JButton jb_reset;
	private javax.swing.JPasswordField passwordTxt;
	private javax.swing.JTextField userNameTxt;
	// End of variables declaration//GEN-END:variables

}

RegisterFrm.java

/*
 * RegisterFrm.java
 *
 * Created on __DATE__, __TIME__
 */

package com.sjsq.client;

import java.sql.Connection;

import javax.swing.JOptionPane;

import com.sjsq.common.User;
import com.sjsq.server.UserDao;
import com.sjsq.utils.DbUtil;
import com.sjsq.utils.StringUtil;

/**
 * 注册
 * @author __USER__
 */
public class RegisterFrm extends javax.swing.JFrame {
	DbUtil dbUtil = new DbUtil();
	UserDao userDao = new UserDao();

	/** Creates new form RegisterFrm */
	public RegisterFrm() {
		initComponents();
		// 设置frame居中显示
		this.setLocationRelativeTo(null);
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	// GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		jLabel2 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();
		jLabel5 = new javax.swing.JLabel();
		jb_register = new javax.swing.JButton();
		jb_reset = new javax.swing.JButton();
		userNameTxt = new javax.swing.JTextField();
		emailTxt = new javax.swing.JTextField();
		passwordTxt = new javax.swing.JPasswordField();
		passwordConfirmTxt = new javax.swing.JPasswordField();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("用户注册");
		setResizable(false);

		jLabel1.setFont(new java.awt.Font("宋体", 1, 18));
		jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/new_register.png"))); // NOI18N
		jLabel1.setText("新用户注册");

		jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/new_user.png"))); // NOI18N
		jLabel2.setText("用户名:");

		jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/new_password.png"))); // NOI18N
		jLabel3.setText("密码:");

		jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/password_config.png"))); // NOI18N
		jLabel4.setText("确认密码:");

		jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/email.png"))); // NOI18N
		jLabel5.setText("邮箱:");

		jb_register.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/register.png"))); // NOI18N
		jb_register.setText("注册");
		jb_register.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jb_registerActionPerformed(evt);
			}
		});

		jb_reset.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/reset.png"))); // NOI18N
		jb_reset.setText("重置");
		jb_reset.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jb_resetActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(layout.createSequentialGroup()
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
								.addGroup(layout.createSequentialGroup().addGap(95, 95, 95).addComponent(jLabel1))
								.addGroup(layout.createSequentialGroup().addGap(57, 57, 57).addComponent(jb_register)
										.addGap(63, 63, 63).addComponent(jb_reset)))
						.addContainerGap())
				.addGroup(layout.createSequentialGroup().addGap(40, 40, 40)
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
								.addComponent(jLabel2).addComponent(jLabel5).addComponent(jLabel3)
								.addComponent(jLabel4))
						.addGap(28, 28, 28)
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
								.addComponent(passwordConfirmTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 146,
										Short.MAX_VALUE)
								.addComponent(emailTxt, javax.swing.GroupLayout.Alignment.LEADING,
										javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
								.addComponent(userNameTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
								.addComponent(passwordTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE))
						.addGap(40, 40, 40)));
		layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout
				.createSequentialGroup().addGap(19, 19, 19).addComponent(jLabel1).addGap(18, 18, 18)
				.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel2)
						.addComponent(userNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
				.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel3)
						.addComponent(passwordTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
						javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
				.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel4)
						.addComponent(passwordConfirmTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
				.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
						.addComponent(emailTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
								javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
						.addComponent(jLabel5))
				.addGap(28, 28, 28).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
						.addComponent(jb_register).addComponent(jb_reset))
				.addGap(55, 55, 55)));

		pack();
	}// </editor-fold>
		// GEN-END:initComponents
		// 注册验证操作

	private void jb_registerActionPerformed(java.awt.event.ActionEvent evt) {
		String userName = this.userNameTxt.getText();
		String password = new String(this.passwordTxt.getPassword());
		String passwordConfirm = new String(this.passwordConfirmTxt.getPassword());
		String email = this.emailTxt.getText();
		if (StringUtil.isEmpty(userName)) {
			JOptionPane.showMessageDialog(null, "用户名不能为空");
			return;
		}
		if (StringUtil.isEmpty(password)) {
			JOptionPane.showMessageDialog(null, "密码不能为空");
			return;
		}
		if (!password.equals(passwordConfirm)) {
			JOptionPane.showMessageDialog(null, "两次输入的密码不一致!");
			return;
		}
		if (!StringUtil.checkEmail(email)) {
			JOptionPane.showMessageDialog(null, "邮箱格式错误!");
			return;
		}
		User user = new User(userName, password, email);
		Connection con = null;
		try {
			con = dbUtil.getCon();
			if (!userDao.isUserExist(con, user)) {
				int addNum = userDao.userAdd(con, user);
				if (addNum == 1) {
					JOptionPane.showMessageDialog(null, "注册成功!");
					this.dispose();
					new LogOnFrm().setVisible(true);
				} else {
					JOptionPane.showMessageDialog(null, "注册失败");
				}
			} else {
				JOptionPane.showMessageDialog(null, "用户名存在,请重新输入!");
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "注册失败,请重新注册!");
		} finally {
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

	}

	// 重置表单
	private void jb_resetActionPerformed(java.awt.event.ActionEvent evt) {
		this.userNameTxt.setText("");
		this.passwordTxt.setText("");
		this.passwordConfirmTxt.setText("");
		this.emailTxt.setText("");
	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new RegisterFrm().setVisible(true);
			}
		});
	}

	// GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JTextField emailTxt;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JButton jb_register;
	private javax.swing.JButton jb_reset;
	private javax.swing.JPasswordField passwordConfirmTxt;
	private javax.swing.JPasswordField passwordTxt;
	private javax.swing.JTextField userNameTxt;
	// End of variables declaration//GEN-END:variables

}

AdminFrm.java

/*
 * AdminFrm.java
 *
 * Created on __DATE__, __TIME__
 */

package com.sjsq.client;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * 管理员主页面模块
 * 
 * @author __USER__
 */
public class AdminFrm extends javax.swing.JFrame {

	/** Creates new form AdminFrm */
	public AdminFrm() {
		initComponents();
		// 设置最大化
		//this.setExtendedState(JFrame.MAXIMIZED_BOTH);
		this.setBounds(500, 500, 1200, 700);// 设置大小
		// 设置frame居中显示
		this.setLocationRelativeTo(null);
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	// GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		table = new javax.swing.JDesktopPane();
		jMenuBar1 = new javax.swing.JMenuBar();
		jMenu1 = new javax.swing.JMenu();
		jmiGoodsAdd = new javax.swing.JMenuItem();
		jmiGoodsManage = new javax.swing.JMenuItem();
		jMenu3 = new javax.swing.JMenu();
		jmiDealOrder = new javax.swing.JMenuItem();
		jMenu4 = new javax.swing.JMenu();
		jmiModify = new javax.swing.JMenuItem();
		jmiExit = new javax.swing.JMenuItem();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("管理员主界面");

		jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/base.png"))); // NOI18N
		jMenu1.setText("套餐信息管理");

		jmiGoodsAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/add.png"))); // NOI18N
		jmiGoodsAdd.setText("新增套餐");
		jmiGoodsAdd.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmiGoodsAddActionPerformed(evt);
			}
		});
		jMenu1.add(jmiGoodsAdd);

		jmiGoodsManage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/edit.png"))); // NOI18N
		jmiGoodsManage.setText("维护套餐");
		jmiGoodsManage.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmiGoodsManageActionPerformed(evt);
			}
		});
		jMenu1.add(jmiGoodsManage);

		jMenuBar1.add(jMenu1);

		jMenu3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/bookManager.png"))); // NOI18N
		jMenu3.setText("订单管理");

		jmiDealOrder.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/order2.png"))); // NOI18N
		jmiDealOrder.setText("订单处理");
		jmiDealOrder.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmiDealOrderActionPerformed(evt);
			}
		});
		jMenu3.add(jmiDealOrder);

		jMenuBar1.add(jMenu3);

		jMenu4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/about.png"))); // NOI18N
		jMenu4.setText("其他");

		jmiModify.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/modify.png"))); // NOI18N
		jmiModify.setText("修改密码");
		jmiModify.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmiModifyActionPerformed(evt);
			}
		});
		//jMenu4.add(jmiModify);

		jmiExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/exit.png"))); // NOI18N
		jmiExit.setText("退出系统");
		jmiExit.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmiExitActionPerformed(evt);
			}
		});
		jMenu4.add(jmiExit);

		jMenuBar1.add(jMenu4);

		setJMenuBar(jMenuBar1);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addComponent(table, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE));
		layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addComponent(table, javax.swing.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE));

		pack();
	}// </editor-fold>
		// GEN-END:initComponents

	// 订单处理操作
	private void jmiDealOrderActionPerformed(java.awt.event.ActionEvent evt) {
		DealOrderInterFrm dealOrderInterFrm = new DealOrderInterFrm();
		dealOrderInterFrm.setVisible(true);
		this.table.add(dealOrderInterFrm);
	}

	// 修改用户信息操作
	void jmiModifyActionPerformed(java.awt.event.ActionEvent evt) {
		AccountModifyInterFrm accountModify = new AccountModifyInterFrm();
		accountModify.setVisible(true);
		this.table.add(accountModify);
	}

	// 套餐维护管理
	private void jmiGoodsManageActionPerformed(java.awt.event.ActionEvent evt) {
		GoodsManageInterFrm goodsManageInterFrm = new GoodsManageInterFrm();
		goodsManageInterFrm.setVisible(true);
		this.table.add(goodsManageInterFrm);
	}

	// 套餐添加
	private void jmiGoodsAddActionPerformed(java.awt.event.ActionEvent evt) {
		GoodsAddInterFrm goodsAddInterFrm = new GoodsAddInterFrm();
		goodsAddInterFrm.setVisible(true);
		this.table.add(goodsAddInterFrm);
	}

	// 退出系统
	private void jmiExitActionPerformed(java.awt.event.ActionEvent evt) {
		int result = JOptionPane.showConfirmDialog(null, "是否退出点餐系统?");
		// System.out.println(result);
		if (result == 0)
			this.dispose();

	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new AdminFrm().setVisible(true);
			}
		});
	}

	// GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JMenu jMenu1;
	private javax.swing.JMenu jMenu3;
	private javax.swing.JMenu jMenu4;
	private javax.swing.JMenuBar jMenuBar1;
	private javax.swing.JMenuItem jmiDealOrder;
	private javax.swing.JMenuItem jmiExit;
	private javax.swing.JMenuItem jmiGoodsAdd;
	private javax.swing.JMenuItem jmiGoodsManage;
	private javax.swing.JMenuItem jmiModify;
	private javax.swing.JDesktopPane table;
	// End of variables declaration//GEN-END:variables

}

UserOrderFrm.java

/*
 * UserFrm.java
 *
 * Created on __DATE__, __TIME__
 */

package com.sjsq.client;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * 用户主界面
 * 
 * @author __USER__
 */
public class UserOrderFrm extends javax.swing.JFrame {

	/** Creates new form UserFrm */
	public UserOrderFrm() {
		initComponents();
		// 设置最大化
		//this.setExtendedState(JFrame.MAXIMIZED_BOTH);
		this.setBounds(500, 500, 1200, 700);// 设置大小
		// 设置frame居中显示
		this.setLocationRelativeTo(null);
	}

	// GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		table = new javax.swing.JDesktopPane();
		jMenuBar1 = new javax.swing.JMenuBar();
		jm_order = new javax.swing.JMenu();
		jmi_order = new javax.swing.JMenuItem();
		jMenu2 = new javax.swing.JMenu();
		jmi_checkOrder = new javax.swing.JMenuItem();
		jMenu3 = new javax.swing.JMenu();
		jmi_modify = new javax.swing.JMenuItem();
		jmiExit = new javax.swing.JMenuItem();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("用户点餐主界面");

		jm_order.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/order3.png"))); // NOI18N
		jm_order.setText("用户点餐");

		jmi_order.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/cart.png"))); // NOI18N
		jmi_order.setText("开始点餐");
		jmi_order.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmi_orderActionPerformed(evt);
			}
		});
		jm_order.add(jmi_order);

		jMenuBar1.add(jm_order);

		jMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/search1.png"))); // NOI18N
		jMenu2.setText("订单详情");

		jmi_checkOrder.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ok.png"))); // NOI18N
		jmi_checkOrder.setText("查看订单");
		jmi_checkOrder.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmi_checkOrderActionPerformed(evt);
			}
		});
		jMenu2.add(jmi_checkOrder);

		jMenuBar1.add(jMenu2);

		jMenu3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/about.png"))); // NOI18N
		jMenu3.setText("关于系统");

		jmi_modify.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/edit.png"))); // NOI18N
		jmi_modify.setText("修改密码");
		jmi_modify.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmi_modifyActionPerformed(evt);
			}
		});
		jMenu3.add(jmi_modify);

		jmiExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/exit.png"))); // NOI18N
		jmiExit.setText("退出系统");
		jmiExit.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jmiExitActionPerformed(evt);
			}
		});
		jMenu3.add(jmiExit);

		jMenuBar1.add(jMenu3);

		setJMenuBar(jMenuBar1);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addComponent(table, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE));
		layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addComponent(table, javax.swing.GroupLayout.DEFAULT_SIZE, 277, Short.MAX_VALUE));

		pack();
	}// </editor-fold>
		// GEN-END:initComponents
		// 修改用户信息按钮

	private void jmi_modifyActionPerformed(java.awt.event.ActionEvent evt) {
		AccountModifyInterFrm accountModify = new AccountModifyInterFrm();
		accountModify.setVisible(true);
		this.table.add(accountModify);
	}

	// 查看订单按钮
	private void jmi_checkOrderActionPerformed(java.awt.event.ActionEvent evt) {
		CheckOrderInterFrm CheckOrderInterFrm = new CheckOrderInterFrm();
		CheckOrderInterFrm.setVisible(true);
		this.table.add(CheckOrderInterFrm);
	}

	// 退出按钮
	private void jmiExitActionPerformed(java.awt.event.ActionEvent evt) {
		int result = JOptionPane.showConfirmDialog(null, "是否退出系统?");
		// System.out.println(result);
		if (result == 0)
			this.dispose();
	}

	// 点餐按钮
	private void jmi_orderActionPerformed(java.awt.event.ActionEvent evt) {
		OrderGoodsInterFrm orderGoodsInterFrm = new OrderGoodsInterFrm();
		orderGoodsInterFrm.setVisible(true);
		this.table.add(orderGoodsInterFrm);
	}

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				new UserOrderFrm().setVisible(true);
			}
		});
	}

	// GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JMenu jMenu2;
	private javax.swing.JMenu jMenu3;
	private javax.swing.JMenuBar jMenuBar1;
	private javax.swing.JMenu jm_order;
	private javax.swing.JMenuItem jmiExit;
	private javax.swing.JMenuItem jmi_checkOrder;
	private javax.swing.JMenuItem jmi_modify;
	private javax.swing.JMenuItem jmi_order;
	private javax.swing.JDesktopPane table;
	// End of variables declaration//GEN-END:variables

}

AccountModifyInterFrm.java

/*
 * AccountModify.java
 *
 * Created on __DATE__, __TIME__
 */

package com.sjsq.client;

import java.sql.Connection;

import javax.swing.JOptionPane;

import com.sjsq.common.User;
import com.sjsq.server.UserDao;
import com.sjsq.utils.DbUtil;
import com.sjsq.utils.StringUtil;

/**
 * 账号修改模块
 * 
 * @author __USER__
 */
public class AccountModifyInterFrm extends javax.swing.JInternalFrame {
	DbUtil dbUtil = new DbUtil();
	UserDao userDao = new UserDao();

	/** Creates new form AccountModify */
	public AccountModifyInterFrm() {
		initComponents();
		this.setLocation(320, 100);
		this.userNameTxt.setText(LogOnFrm.s_currentUser.getUserName());
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	// GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		jLabel2 = new javax.swing.JLabel();
		jLabel3 = new javax.swing.JLabel();
		jLabel4 = new javax.swing.JLabel();
		jb_modify = new javax.swing.JButton();
		jb_reset = new javax.swing.JButton();
		userNameTxt = new javax.swing.JTextField();
		oldPasswordTxt = new javax.swing.JPasswordField();
		newPasswordTxt = new javax.swing.JPasswordField();
		newPasswordConfirmTxt = new javax.swing.JPasswordField();

		setClosable(true);
		setIconifiable(true);
		setTitle("账户信息修改");

		jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/userName.png"))); // NOI18N
		jLabel1.setText("用户名:");

		jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/password.png"))); // NOI18N
		jLabel2.setText("旧密码:");

		jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/new_password.png"))); // NOI18N
		jLabel3.setText("新密码:");

		jLabel4.setText("新密码确认");

		jb_modify.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/edit.png"))); // NOI18N
		jb_modify.setText("确认修改");
		jb_modify.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jb_modifyActionPerformed(evt);
			}
		});

		jb_reset.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/reset.png"))); // NOI18N
		jb_reset.setText("重置");
		jb_reset.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jb_resetActionPerformed(evt);
			}
		});

		userNameTxt.setEnabled(false);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout
				.createSequentialGroup()
				.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
						.addGroup(layout.createSequentialGroup().addGap(37, 37, 37)
								.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
										.addComponent(jLabel1).addComponent(jLabel2).addComponent(jLabel3)
										.addComponent(jLabel4))
								.addGap(35, 35, 35)
								.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
										.addComponent(newPasswordConfirmTxt, javax.swing.GroupLayout.Alignment.LEADING)
										.addComponent(newPasswordTxt, javax.swing.GroupLayout.Alignment.LEADING)
										.addComponent(oldPasswordTxt, javax.swing.GroupLayout.Alignment.LEADING)
										.addComponent(userNameTxt, javax.swing.GroupLayout.Alignment.LEADING,
												javax.swing.GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE)))
						.addGroup(layout.createSequentialGroup().addGap(47, 47, 47).addComponent(jb_modify)
								.addGap(18, 18, 18).addComponent(jb_reset, javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
				.addContainerGap(65, Short.MAX_VALUE)));
		layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGap(41, 41, 41)
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
								.addComponent(jLabel1).addComponent(userNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
						.addGap(18, 18, 18)
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
								.addComponent(jLabel2)
								.addComponent(oldPasswordTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
						.addGap(18, 18, 18)
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
								.addComponent(jLabel3)
								.addComponent(newPasswordTxt, javax.swing.GroupLayout.PREFERRED_SIZE,
										javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
						.addGap(12, 12, 12)
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
								.addComponent(jLabel4).addComponent(newPasswordConfirmTxt,
										javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
										javax.swing.GroupLayout.PREFERRED_SIZE))
						.addGap(30, 30, 30)
						.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
								.addComponent(jb_modify).addComponent(jb_reset))
						.addGap(40, 40, 40)));

		pack();
	}// </editor-fold>
		// GEN-END:initComponents

	private void jb_modifyActionPerformed(java.awt.event.ActionEvent evt) {
		String oldPassword = new String(this.oldPasswordTxt.getPassword());
		String newPassword1 = new String(this.newPasswordTxt.getPassword());
		String newPassword2 = new String(this.newPasswordConfirmTxt.getPassword());
		if (StringUtil.isEmpty(oldPassword)) {
			JOptionPane.showMessageDialog(null, "旧密码不能为空!");
			return;
		}
		if (StringUtil.isEmpty(newPassword1) || StringUtil.isEmpty(newPassword2)) {
			JOptionPane.showMessageDialog(null, "新密码不能为空!");
			return;
		}
		if (!newPassword1.equals(newPassword2)) {
			JOptionPane.showMessageDialog(null, "两次输入的密码不一致!");
			return;
		}
		User user = null;
		Connection con = null;
		try {
			con = dbUtil.getCon();
			user = new User(LogOnFrm.s_currentUser.getUserName(), oldPassword);
			if (userDao.login(con, user) != null) {
				user.setPassword(newPassword1);
				user.setId(LogOnFrm.s_currentUser.getId());
				int modifyNum = userDao.userModify(con, user);
				if (1 == modifyNum) {
					JOptionPane.showMessageDialog(null, "修改成功!");
					this.oldPasswordTxt.setText("");
					this.newPasswordTxt.setText("");
					this.newPasswordConfirmTxt.setText("");
				} else {
					JOptionPane.showMessageDialog(null, "修改失败,请重新输入");
				}
			} else {
				JOptionPane.showMessageDialog(null, "旧密码错误!请重新输入");
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	private void jb_resetActionPerformed(java.awt.event.ActionEvent evt) {
		this.oldPasswordTxt.setText("");
		this.newPasswordTxt.setText("");
		this.newPasswordConfirmTxt.setText("");
	}

	// GEN-BEGIN:variables
	// Variables declaration - do not modify
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JButton jb_modify;
	private javax.swing.JButton jb_reset;
	private javax.swing.JPasswordField newPasswordConfirmTxt;
	private javax.swing.JPasswordField newPasswordTxt;
	private javax.swing.JPasswordField oldPasswordTxt;
	private javax.swing.JTextField userNameTxt;
	// End of variables declaration//GEN-END:variables

}

 四、其他

1.其他系统实现

1.JavaWeb系统系列实现

Java+JSP实现学生图书管理系统

Java+JSP实现学生信息管理系统

Java+JSP实现用户信息管理系统

Java+Servlet+JSP实现航空订票系统

Java+Servlet+JSP实现新闻发布系统

Java+Servlet+JSP实现图书管理系统

Java+Servlet+JSP实现停车场管理系统

Java+Servlet+JSP实现学生信息管理系统

Java+Servlet+JSP实现学生选课管理系统

Java+Servlet+JSP实现学生成绩管理系统-1

Java+Servlet+JSP实现学生成绩管理系统-2

Java+Servlet+JSP实现宠物诊所管理系统

Java+SSM+JSP实现网上考试系统

Java+SSH+JSP实现在线考试系统

Java+SSH+JSP实现医院在线挂号系统

Java+Springboot+Mybatis+Bootstrap+Maven实现网上商城系统

2.JavaSwing系统系列实现

Java+Swing实现斗地主游戏

Java+Swing实现电影购票系统

Java+Swing实现图书管理系统

Java+Swing实现医院管理系统

Java+Swing实现考试管理系统

Java+Swing实现仓库管理系统-1

Java+Swing实现仓库管理系统-2

Java+Swing实现自助取款机系统

Java+Swing实现通讯录管理系统

Java+Swing实现停车场管理系统

Java+Swing实现学生信息管理系统

Java+Swing实现学生宿舍管理系统

Java+Swing实现学生选课管理系统

Java+Swing实现学生成绩管理系统

Java+Swing实现学校教材管理系统

Java+Swing实现学校教务管理系统

Java+Swing实现企业人事管理系统

Java+Swing实现电子相册管理系统

Java+Swing实现超市管理系统-TXT存储数据

Java+Swing实现自助取款机系统-TXT存储数据

Java+Swing实现宠物商店管理系统-TXT存储数据

2.获取源码

点击以下链接获取源码,数据库文件在sql文件下面。

3.运行项目

请点击以下链接,部署你的项目。

Eclipse如何导入JavaSwing项目超详细图文教程

Eclipse如何导入JavaSwing项目超详细视频教程

4.备注

如有侵权请联系我删除。

5.支持博主

如果您觉得此文对您有帮助,请点赞加关注加收藏。祝您生活愉快!想要获取其他资源可关注左侧微信公众号获取!

标签:Java,java,GroupLayout,Swing,Eclipse,private,swing,new,javax
来源: https://blog.csdn.net/helongqiang/article/details/120767739

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有