Eclipse+Java+Swing+Mysql to realize online ordering system [recommended collection]

Keywords: Java MySQL Eclipse swing

catalogue

1, System introduction

1. Development environment

2. Technical selection

3. System functions

4. Database

2, System display

1. Log in to the system

2. User registration system

3. User - main interface

4. User - user orders

5. User - query order

6. User - change password

7. Administrator - main interface

8. Administrator - new package

9. Administrator - maintenance package

10. Administrator - order management

3, Partial code

LogOnFrm.java

RegisterFrm.java

AdminFrm.java

UserOrderFrm.java

AccountModifyInterFrm.java

  4, Other

1. Other system implementation

1. Java Web system series implementation

2.JavaSwing system series implementation

2. Access to source code

3. Operation project

4. Remarks

5. Support bloggers

 

JavaSwing system implementation series

Realizing landlords fighting game with Java+Swing

Implementation of movie ticket purchase system with java + swing

Implementation of library management system with Java+Swing

Implementation of hospital management system with Java+Swing

Implementation of examination management system with Java+Swing

Implementation of warehouse management System-1 with Java+Swing

Implementation of warehouse management System-2 with Java+Swing

Implementation of self-service ATM system with Java+Swing

Implementation of address book management system with Java+Swing

Implementation of parking lot management system with Java+Swing

Implementation of student information management system with Java+Swing

Implementation of student dormitory management system with Java+Swing

Implementation of student course selection management system with Java+Swing

Implementation of student achievement management system with Java+Swing

Implementation of school textbook management system with Java+Swing

Implementation of school educational administration management system with Java+Swing

Implementation of enterprise personnel management system with Java+Swing

Implementation of electronic album management system with Java+Swing

Java+Swing to realize supermarket management system TXT to store data

Java+Swing to realize self-service ATM system - TXT to store data

Java+Swing to realize pet store management system TXT to store data

1, System introduction

1. Development environment

Development tool: Eclipse 2021

JDK version: jdk1.8

Mysql version: 8.0.13

2. Technical selection

Java+Swing+Mysql

3. System functions

user

1. Log in to the system

2. Registration system

3. User ordering

4. Query order

5. Change password

administrators

1. Log in to the system

2. New package

3. Maintenance package

4. Order management

4. Database

/*
 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, 'Grilled chicken Sushi', 23.1, 'Chicken, lettuce, seaweed, sushi', 'E:\\codes\\BusinessCodes\\JavaSwing\\OrderMeal\\src\\images\\ss1.png');
INSERT INTO `goods` VALUES (2, 'Hokkaido Sushi', 13.2, 'Fish, sweet chili sauce, seaweed, rice', 'E:\\codes\\BusinessCodes\\JavaSwing\\OrderMeal\\src\\images\\ss2.png');
INSERT INTO `goods` VALUES (3, 'Eel fried Sushi', 43.2, 'Fish, sweet chili sauce, seaweed, rice', '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, 'Eel fried Sushi');
INSERT INTO `order_goods` VALUES (45, '20190319141543', 13.2, 2, 13.2, 1, 'Hokkaido Sushi');
INSERT INTO `order_goods` VALUES (46, '20211014114920', 23.1, 1, 23.1, 1, 'Grilled chicken Sushi');
INSERT INTO `order_goods` VALUES (47, '20211014161704', 23.1, 1, 23.1, 1, 'Grilled chicken Sushi');
INSERT INTO `order_goods` VALUES (48, '20211014162614', 13.2, 2, 13.2, 1, 'Hokkaido Sushi');

-- ----------------------------
-- 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;

2, System display

1. Log in to the system

2. User registration system

3. User - main interface

4. User - user orders

5. User - query order

6. User - change password

7. Administrator - main interface

8. Administrator - new package

9. Administrator - maintenance package

10. Administrator - order management

3, Partial code

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;

/**
 * User login
 * 
 * @author __USER__
 */
public class LogOnFrm extends javax.swing.JFrame {

	DbUtil dbUtil = new DbUtil();
	UserDao userDao = new UserDao();
	public static User s_currentUser = null;// Save login user parameters

	/** Creates new form LogOnFrm */
	public LogOnFrm() {
		// Change system default font
		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();
		// Set frame to center
		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("Online ordering system");
		setResizable(false);

		jLabel1.setFont(new java.awt.Font("Song typeface", 1, 24));
		jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/OrderMeal.png"))); // NOI18N
		jLabel1.setText("Welcome to the restaurant ordering system");

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

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

		jb_logon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/login.png"))); // NOI18N
		jb_logon.setText("Sign in");
		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("register");
		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("Reset");
		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

	// Show registration page
	private void jb_registerActionPerformed(java.awt.event.ActionEvent evt) {
		this.dispose();
		new RegisterFrm().setVisible(true);
	}

	// Login verification displays the interface after login
	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, "User name cannot be empty");
			return;
		}
		if (StringUtil.isEmpty(password)) {
			JOptionPane.showMessageDialog(null, "Password cannot be empty");
			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;// Save logged in user
				int role = currentUser.getRank();
				if (role == 1) {
					this.dispose();
					new AdminFrm().setVisible(true);// Enter the administrator page
				} else if (role == 0) {
					this.dispose();
					new UserOrderFrm().setVisible(true);// Enter the user ordering interface
				}
			} else {
				JOptionPane.showMessageDialog(null, "Wrong user name or password");
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "Wrong user name or password");
		} finally {
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

	}

	// Reset text box contents
	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;

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

	/** Creates new form RegisterFrm */
	public RegisterFrm() {
		initComponents();
		// Set frame to center
		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("User registration");
		setResizable(false);

		jLabel1.setFont(new java.awt.Font("Song typeface", 1, 18));
		jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/new_register.png"))); // NOI18N
		jLabel1.setText("New user registration");

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

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

		jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/password_config.png"))); // NOI18N
		jLabel4.setText("Confirm password:");

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

		jb_register.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/register.png"))); // NOI18N
		jb_register.setText("register");
		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("Reset");
		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
		// Registration verification operation

	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, "User name cannot be empty");
			return;
		}
		if (StringUtil.isEmpty(password)) {
			JOptionPane.showMessageDialog(null, "Password cannot be empty");
			return;
		}
		if (!password.equals(passwordConfirm)) {
			JOptionPane.showMessageDialog(null, "The passwords entered twice are inconsistent!");
			return;
		}
		if (!StringUtil.checkEmail(email)) {
			JOptionPane.showMessageDialog(null, "Email format error!");
			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, "Registration succeeded!");
					this.dispose();
					new LogOnFrm().setVisible(true);
				} else {
					JOptionPane.showMessageDialog(null, "login has failed");
				}
			} else {
				JOptionPane.showMessageDialog(null, "User name exists, please re-enter!");
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			JOptionPane.showMessageDialog(null, "Registration failed, please re register!");
		} finally {
			try {
				dbUtil.closeCon(con);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

	}

	// Reset Form 
	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;

/**
 * Administrator main page module
 * 
 * @author __USER__
 */
public class AdminFrm extends javax.swing.JFrame {

	/** Creates new form AdminFrm */
	public AdminFrm() {
		initComponents();
		// Set maximization
		//this.setExtendedState(JFrame.MAXIMIZED_BOTH);
		this.setBounds(500, 500, 1200, 700);// Set size
		// Set frame to center
		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("Administrator main interface");

		jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/base.png"))); // NOI18N
		jMenu1.setText("Package information management");

		jmiGoodsAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/add.png"))); // NOI18N
		jmiGoodsAdd.setText("New package");
		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("Maintenance package");
		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("Order management");

		jmiDealOrder.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/order2.png"))); // NOI18N
		jmiDealOrder.setText("Order processing");
		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("other");

		jmiModify.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/modify.png"))); // NOI18N
		jmiModify.setText("Change Password");
		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("Exit the system");
		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

	// Order processing operation
	private void jmiDealOrderActionPerformed(java.awt.event.ActionEvent evt) {
		DealOrderInterFrm dealOrderInterFrm = new DealOrderInterFrm();
		dealOrderInterFrm.setVisible(true);
		this.table.add(dealOrderInterFrm);
	}

	// Modify user information
	void jmiModifyActionPerformed(java.awt.event.ActionEvent evt) {
		AccountModifyInterFrm accountModify = new AccountModifyInterFrm();
		accountModify.setVisible(true);
		this.table.add(accountModify);
	}

	// Package maintenance management
	private void jmiGoodsManageActionPerformed(java.awt.event.ActionEvent evt) {
		GoodsManageInterFrm goodsManageInterFrm = new GoodsManageInterFrm();
		goodsManageInterFrm.setVisible(true);
		this.table.add(goodsManageInterFrm);
	}

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

	// Exit the system
	private void jmiExitActionPerformed(java.awt.event.ActionEvent evt) {
		int result = JOptionPane.showConfirmDialog(null, "Exit ordering system?");
		// 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;

/**
 * Main user interface
 * 
 * @author __USER__
 */
public class UserOrderFrm extends javax.swing.JFrame {

	/** Creates new form UserFrm */
	public UserOrderFrm() {
		initComponents();
		// Set maximization
		//this.setExtendedState(JFrame.MAXIMIZED_BOTH);
		this.setBounds(500, 500, 1200, 700);// Set size
		// Set frame to center
		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("User ordering main interface");

		jm_order.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/order3.png"))); // NOI18N
		jm_order.setText("User ordering");

		jmi_order.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/cart.png"))); // NOI18N
		jmi_order.setText("Start ordering");
		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("Order details");

		jmi_checkOrder.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ok.png"))); // NOI18N
		jmi_checkOrder.setText("View order");
		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("About system");

		jmi_modify.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/edit.png"))); // NOI18N
		jmi_modify.setText("Change Password");
		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("Exit the system");
		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
		// Modify user information button

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

	// View order button
	private void jmi_checkOrderActionPerformed(java.awt.event.ActionEvent evt) {
		CheckOrderInterFrm CheckOrderInterFrm = new CheckOrderInterFrm();
		CheckOrderInterFrm.setVisible(true);
		this.table.add(CheckOrderInterFrm);
	}

	// Exit button
	private void jmiExitActionPerformed(java.awt.event.ActionEvent evt) {
		int result = JOptionPane.showConfirmDialog(null, "Exit the system?");
		// System.out.println(result);
		if (result == 0)
			this.dispose();
	}

	// Order button
	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;

/**
 * Account modification module
 * 
 * @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("Account information modification");

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

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

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

		jLabel4.setText("New password confirmation");

		jb_modify.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/edit.png"))); // NOI18N
		jb_modify.setText("Confirm modification");
		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("Reset");
		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, "Old password cannot be empty!");
			return;
		}
		if (StringUtil.isEmpty(newPassword1) || StringUtil.isEmpty(newPassword2)) {
			JOptionPane.showMessageDialog(null, "New password cannot be empty!");
			return;
		}
		if (!newPassword1.equals(newPassword2)) {
			JOptionPane.showMessageDialog(null, "The passwords entered twice are inconsistent!");
			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, "Modification succeeded!");
					this.oldPasswordTxt.setText("");
					this.newPasswordTxt.setText("");
					this.newPasswordConfirmTxt.setText("");
				} else {
					JOptionPane.showMessageDialog(null, "Modification failed, please re-enter");
				}
			} else {
				JOptionPane.showMessageDialog(null, "Old password error! Please re-enter");
			}
		} 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

}

  4, Other

1. Other system implementation

1. Java Web system series implementation

Implementation of student library management system with Java+JSP

Implementation of student information management system with Java+JSP

Implementation of user information management system with Java+JSP

Implementation of air booking system with Java+Servlet+JSP

Implementation of news release system with Java+Servlet+JSP

Implementation of library management system with Java+Servlet+JSP

Implementation of parking lot management system with Java+Servlet+JSP

Implementation of student information management system with Java+Servlet+JSP

Implementation of student course selection management system with Java+Servlet+JSP

Implementation of student achievement management System-1 with Java+Servlet+JSP

Java+Servlet+JSP to realize student achievement management System-2

Implementation of pet clinic management system with Java+Servlet+JSP

Implementation of online examination system with Java+SSM+JSP

Implementation of online examination system with Java+SSH+JSP

Implementation of hospital online registration system with Java+SSH+JSP

Java+Springboot+Mybatis+Bootstrap+Maven to realize the online mall system

2.JavaSwing system series implementation

Realizing landlords fighting game with Java+Swing

Implementation of movie ticket purchase system with Java+Swing

Implementation of library management system with Java+Swing

Implementation of hospital management system with Java+Swing

Implementation of examination management system with Java+Swing

Implementation of warehouse management System-1 with Java+Swing

Implementation of warehouse management System-2 with Java+Swing

Implementation of self-service ATM system with Java+Swing

Implementation of address book management system with Java+Swing

Implementation of parking lot management system with Java+Swing

Implementation of student information management system with Java+Swing

Implementation of student dormitory management system with Java+Swing

Implementation of student course selection management system with Java+Swing

Implementation of student achievement management system with Java+Swing

Implementation of school textbook management system with Java+Swing

Implementation of school educational administration management system with Java+Swing

Implementation of enterprise personnel management system with Java+Swing

Implementation of electronic album management system with Java+Swing

Java+Swing to realize supermarket management system TXT to store data

Java+Swing to realize self-service ATM system - TXT to store data

Java+Swing to realize pet store management system TXT to store data

2. Access to source code

Click the following link to get the source code. The database file is under the sql file.

3. Operation project

Please click the link below to deploy your project.

Eclipse how to import Java Swing project hyperdetailed graphic tutorial

Eclipse how to import Java Swing project super detailed video tutorial

4. Remarks

If there is infringement, please contact me to delete.

5. Support bloggers

If you think this article is helpful to you, please pay attention to it. I wish you a happy life! For other resources, you can focus on the official account of the left WeChat public.

Posted by yogicasey on Thu, 14 Oct 2021 14:43:58 -0700