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

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

//

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

}//

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

//

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

}//

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

//

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

}//

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

//

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

}//

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

}

/**

  • 5
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值