Java最全Eclipse+Java+Swing+Mysql实现网上订餐系统【建议收藏】,学了阿里P8级架构师的7+1+1落地项目

写在最后

很多人感叹“学习无用”,实际上之所以产生无用论,是因为自己想要的与自己所学的匹配不上,这也就意味着自己学得远远不够。无论是学习还是工作,都应该有主动性,所以如果拥有大厂梦,那么就要自己努力去实现它。

最后祝愿各位身体健康,顺利拿到心仪的offer!

由于文章的篇幅有限,所以这次的蚂蚁金服和京东面试题答案整理在了PDF文档里

蚂蚁、京东Java岗4面:原理+索引+底层+分布式+优化等,已拿offer

蚂蚁、京东Java岗4面:原理+索引+底层+分布式+优化等,已拿offer

蚂蚁、京东Java岗4面:原理+索引+底层+分布式+优化等,已拿offer

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

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

}

/**

  • @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

//

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

}//

// 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开发的朋友们有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。

image

image

其实面试这一块早在第一个说的25大面试专题就全都有的。以上提及的这些全部的面试+学习的各种笔记资料,我这差不多来回搞了三个多月,收集整理真的很不容易,其中还有很多自己的一些知识总结。正是因为很麻烦,所以对以上这些学习复习资料感兴趣,

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

va+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开发的朋友们有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。

[外链图片转存中…(img-LJF4ikT4-1715303198007)]

[外链图片转存中…(img-8tRYRM7s-1715303198008)]

其实面试这一块早在第一个说的25大面试专题就全都有的。以上提及的这些全部的面试+学习的各种笔记资料,我这差不多来回搞了三个多月,收集整理真的很不容易,其中还有很多自己的一些知识总结。正是因为很麻烦,所以对以上这些学习复习资料感兴趣,

本文已被CODING开源项目:【一线大厂Java面试题解析+核心总结学习笔记+最新讲解视频+实战项目源码】收录

需要这份系统化的资料的朋友,可以点击这里获取

  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值