网站开发软硬件,济南哪里有做网站的,怎样创建网站信息平台,怎样建立自己的销售网站一、 简介
宿舍管理系统是一个针对学校宿舍管理的软件系统#xff0c;旨在方便学生、宿管和管理员进行宿舍信息管理、学生信息管理以及宿舍评比等操作。该系统使用 Java Swing 进行界面设计#xff0c;分为三个角色#xff1a;管理员、宿管和学生。
二、 功能模块
2.1 管…一、 简介
宿舍管理系统是一个针对学校宿舍管理的软件系统旨在方便学生、宿管和管理员进行宿舍信息管理、学生信息管理以及宿舍评比等操作。该系统使用 Java Swing 进行界面设计分为三个角色管理员、宿管和学生。
二、 功能模块
2.1 管理员功能
学生信息管理 管理员可以进行学生信息的添加、刷新、删除和查询操作。 宿舍信息管理 管理员可以进行宿舍信息的刷新、删除和查询操作以及添加新的宿舍信息。 宿舍评比 管理员可以查看宿舍评比结果。 密码重置 管理员可以重置管理员、宿舍和学生的密码。
2.2 宿管功能
学生信息查看 宿管可以查看学生信息。 宿舍信息查看 宿管可以查看宿舍信息。 宿舍评比 宿管可以对宿舍进行评比并提交评比结果。 密码修改 宿管只可以修改自己的密码。
2.3 学生功能
个人信息查看 学生可以查看自己的个人信息。 宿舍信息查看 学生可以查看自己所在宿舍的信息。 宿舍评比 学生可以参与宿舍评比。 密码修改 学生只可以修改自己的密码。
三、 技术实现
该系统使用 Java Swing 实现界面设计使用 Java 编程语言实现后端逻辑。数据库可以采用 MySQL 或其他关系型数据库来存储学生、宿舍和评比等信息。使用 JDBC 连接数据库进行数据的增删改查操作。同时可以使用密码加密算法对密码进行加密存储增强安全性。
四、数据库分析
1.1 dorm 表
dorm_id宿舍号char(10)主键。 bed_num床位数int(2)。 people_num人数int(2)。
1.2 grade 表
grade_id评分编号int(10)自增主键。 dorm_id宿舍号char(10)外键关联到 dorm 表的 dorm_id。 discipline纪律分int(3)。 checks考勤分int(3)。 health卫生分int(3)。 grade总分int(3)。 dates评分时间date。 managers_id评分人员IDint(11)外键关联到 managers 表的 manager_id。
1.3 lived 表
student_id学号int(11)外键关联到 students 表的 student_id。 dorm_id宿舍号char(10)外键关联到 dorm 表的 dorm_id。 bed_id床号int(1)。 livingdate入住时间date。
1.4 managers 表
manager_name姓名char(20)。 manager_id员工号int(11)主键。 contact联系方式char(11)唯一。
1.5 register 表
identity身份0为管理员1为宿管2为学生int(1)。 account账号int(15)主键。 password密码char(12)。
1.6 students 表
name姓名char(10)。 sex性别char(2)。 birthday出生日期bigint(15)。 addresss地址char(20)。 contact联系方式char(11)唯一。 student_id学号int(9)主键。 college学院char(20)。 major专业char(20)。 classes班级char(10)。 dorm_id宿舍号char(10)外键关联到 dorm 表的 dorm_id。 bed_id床号int(1)。 status状态smallint(1)。
五、程序截图
0.登录与接角色 1.管理员 2.宿管 3.学生 六、部分代码
Login.java
package System;import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.KeyStroke;import Control.RegisterControl;
import Model.RegisterModel;
import Operation.StudentsOperation;
import TableStudent.PersonInformation;SuppressWarnings(serial)
public class Login extends JFrame implements ActionListener {Managers managers;public static JTextField text1;JPasswordField text2 new JPasswordField();private JButton enter new JButton(登 录);Font butfont new Font(宋体, Font.BOLD, 20);private JFrame frame new JFrame();private JPanel jpl new JPanel();JComboBox comboBox;SuppressWarnings(unchecked)public Login() {JLabel label0 new JLabel(宿舍管理系统);label0.setBounds(80, 25, 150, 50);label0.setFont(new Font(华文彩云, Font.BOLD, 23));frame.add(label0);JLabel lab1 new JLabel(身份:);jpl.add(lab1);lab1.setBounds(20, 75, 100, 50);lab1.setFont(new Font(隶书, Font.BOLD, 18));comboBox new JComboBox();comboBox.setBounds(70, 87, 150, 30);comboBox.addItem(管理员);comboBox.addItem(宿管);comboBox.addItem(学生);comboBox.setFont(new Font(华文行楷, Font.PLAIN, 20));jpl.add(comboBox);// 标签JLabel label2 new JLabel(账号:);label2.setBounds(20, 125, 100, 50);label2.setFont(new Font(隶书, Font.BOLD, 18));frame.add(label2);JLabel label3 new JLabel(密码:);label3.setBounds(20, 175, 100, 50);label3.setFont(new Font(隶书, Font.BOLD, 18));frame.add(label3);JLabel label4 new JLabel();label4.setText(HTMLU忘记密码/U/HTMl);label4.setBounds(225, 175, 100, 50);label4.setForeground(Color.BLUE);label4.setFont(new Font(黑体, Font.BOLD, 13));label4.setToolTipText(你是不是傻密码都能忘);label4.addMouseListener(new MouseListener() {public void mouseReleased(MouseEvent e) {}public void mousePressed(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mouseEntered(MouseEvent e) {}public void mouseClicked(MouseEvent e) {JOptionPane.showMessageDialog(null, 请到管理处重置密码, 友情提示, JOptionPane.INFORMATION_MESSAGE);}});frame.add(label4);// 账号text1 new JTextField();text1.setBounds(70, 137, 150, 30);text1.setFont(new Font(黑体, Font.BOLD, 18));frame.add(text1);// 密码text2.setBounds(70, 185, 150, 30);text2.setFont(new Font(, Font.BOLD, 24));text2.setEchoChar(*);frame.add(text2);// 背景JLabel label new JLabel(new ImageIcon(image\\background.jpg));label.setSize(300, 565);Image image this.getToolkit().getImage(image\\icon.png);jpl.setLayout(null);jpl.add(enter);jpl.add(label);// 窗体frame.add(jpl);frame.setIconImage(image);frame.setTitle(登录);frame.setSize(300, 565);frame.setResizable(false);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setLocationRelativeTo(null);frame.setVisible(true);// 登录enter.setBounds(85, 300, 120, 40); // 设置按钮大小enter.setBackground(Color.WHITE);enter.setVisible(true);enter.setLayout(null);enter.setFont(butfont);enter.addActionListener(new ButtonListener());enter.registerKeyboardAction(new ButtonListener(), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),JComponent.WHEN_IN_FOCUSED_WINDOW);}public static void main(String[] args) {new Login();}// 登录监听class ButtonListener implements ActionListener {public void actionPerformed(ActionEvent e) {RegisterControl r new RegisterControl();RegisterModel rr null;boolean bb false;if (text1.getText().length() 0 || text2.getText().length() 0) {JOptionPane.showMessageDialog(null, 账号或密码为空, 系统提示, JOptionPane.ERROR_MESSAGE);return;} else {try {rr r.get(Integer.parseInt(text1.getText()));} catch (NumberFormatException e1) {} catch (Exception e1) {return;}if (rr ! null) {bb rr.getPassword().equals(text2.getText());//System.out.println(rr.getPassword() 数据库中的密码);} else {JOptionPane.showMessageDialog(null, 账号密码有误, 系统提示, JOptionPane.ERROR_MESSAGE);text1.setText(null);text2.setText(null);return;}if (bb) {
// System.out.println(comboBox.getSelectedItem().toString().equals(rr.getIdentity()));if (comboBox.getSelectedIndex()rr.getIdentity()){frame.dispose();if (comboBox.getSelectedIndex()2) {new Students();PersonInformation.jpl.setVisible(true);} else if (comboBox.getSelectedIndex()1) {new Managers();} else {new Administrator();}return;} else {JOptionPane.showOptionDialog(managers, 身份有误, 提示, JOptionPane.DEFAULT_OPTION,JOptionPane.PLAIN_MESSAGE, null, null, null);text2.setText(null);return;}}}JOptionPane.showMessageDialog(null, 账号密码有误, 系统提示, JOptionPane.ERROR_MESSAGE);text1.setText(null);text2.setText(null);}}public void actionPerformed(ActionEvent e) {}}
Managers.java
package System;import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;import ButtonFrame.GradeRefer;
import TableManager.DormTable;
import TableManager.GradeTable;
import TableManager.PartStudentTable;SuppressWarnings(serial)
public class Managers extends JFrame {private JPanel jpl null;private MoveLabel label null;JButton logout, exit;JLabel lab1, lab2, lab3, lab4, lab5;public Managers() {super(宿舍管理系统);jpl new JPanel();label new MoveLabel(欢迎登录宿舍管理系统 欢迎登录宿舍管理系统 欢迎登录宿舍管理系统);label.setOpaque(false); // 透明label.setFont(new Font(宋体, Font.BOLD, 20));label.setSize(1366, 20);label.setBackground(Color.cyan);lab1 new JLabel(HTMLU学生信息/U/HTML);lab1.setFont(new Font(华文楷体, Font.BOLD, 23));lab1.setBounds(35, 50, 100, 50);lab1.setForeground(Color.BLUE);lab1.addMouseListener(new MouseListener() {public void mouseClicked(MouseEvent e) {//System.out.println(按下);PartStudentTable.jp.setVisible(true);DormTable.jp.setVisible(false);GradeTable.jp.setVisible(false);lab1.setForeground(Color.RED);lab2.setForeground(Color.BLUE);lab3.setForeground(Color.BLUE);lab4.setForeground(Color.BLUE);lab5.setForeground(Color.BLUE);}public void mouseEntered(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mousePressed(MouseEvent e) {}public void mouseReleased(MouseEvent e) {}});lab2 new JLabel(HTMLU宿舍信息/U/HTML);lab2.setFont(new Font(华文楷体, Font.BOLD, 23));lab2.setBounds(35, 150, 100, 50);lab2.setForeground(Color.BLUE);lab2.addMouseListener(new MouseListener() {public void mouseClicked(MouseEvent e) {//System.out.println(按下);PartStudentTable.jp.setVisible(false);GradeTable.jp.setVisible(false);DormTable.jp.setVisible(true);lab1.setForeground(Color.BLUE);lab2.setForeground(Color.RED);lab3.setForeground(Color.BLUE);lab4.setForeground(Color.BLUE);lab5.setForeground(Color.BLUE);}public void mouseEntered(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mousePressed(MouseEvent e) {}public void mouseReleased(MouseEvent e) {}});lab3 new JLabel(HTMLU宿舍评比/U/HTML);lab3.setFont(new Font(华文楷体, Font.BOLD, 23));lab3.setBounds(35, 250, 100, 50);lab3.setForeground(Color.BLUE);lab3.addMouseListener(new MouseListener() {public void mouseClicked(MouseEvent e) {//System.out.println(按下);PartStudentTable.jp.setVisible(false);DormTable.jp.setVisible(false);GradeTable.jp.setVisible(true);lab1.setForeground(Color.BLUE);lab2.setForeground(Color.BLUE);lab3.setForeground(Color.RED);lab4.setForeground(Color.BLUE);lab5.setForeground(Color.BLUE);}public void mouseEntered(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mousePressed(MouseEvent e) {}public void mouseReleased(MouseEvent e) {}});lab4 new JLabel(HTMLU评比提交/U/HTML);lab4.setFont(new Font(华文楷体, Font.BOLD, 23));lab4.setBounds(35, 350, 100, 50);lab4.setForeground(Color.BLUE);lab4.addMouseListener(new MouseListener() {public void mouseClicked(MouseEvent e) {//System.out.println(按下);PartStudentTable.jp.setVisible(false);DormTable.jp.setVisible(false);GradeTable.jp.setVisible(false);new GradeRefer();lab1.setForeground(Color.BLUE);lab2.setForeground(Color.BLUE);lab3.setForeground(Color.BLUE);lab4.setForeground(Color.RED);lab5.setForeground(Color.BLUE);}public void mouseEntered(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mousePressed(MouseEvent e) {}public void mouseReleased(MouseEvent e) {}});lab5 new JLabel(HTMLU修改密码/U/HTML);lab5.setFont(new Font(华文楷体, Font.BOLD, 23));lab5.setBounds(35, 450, 100, 50);lab5.setForeground(Color.BLUE);lab5.addMouseListener(new MouseListener() {public void mouseClicked(MouseEvent e) {//System.out.println(按下);PartStudentTable.jp.setVisible(false);DormTable.jp.setVisible(false);GradeTable.jp.setVisible(false);new ChangePassword();lab1.setForeground(Color.BLUE);lab2.setForeground(Color.BLUE);lab3.setForeground(Color.BLUE);lab4.setForeground(Color.BLUE);lab5.setForeground(Color.RED);}public void mouseEntered(MouseEvent e) {}public void mouseExited(MouseEvent e) {}public void mousePressed(MouseEvent e) {}public void mouseReleased(MouseEvent e) {}});JLabel lab new JLabel(new ImageIcon(image\\back.jpg));jpl.add(lab);ImageIcon ilogout new ImageIcon(image\\logout.png);logout new JButton(ilogout);logout.setBounds(240, 550, 100, 45);logout.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {if (e.getSource() logout) {String[] options new String[] { 是, 否 };int n JOptionPane.showOptionDialog(null, 确定注销系统, 提示, JOptionPane.DEFAULT_OPTION,JOptionPane.WARNING_MESSAGE, null, options, options[0]);// 点击是的话注销if (n JOptionPane.YES_OPTION) {setVisible(false);new Login();}}}});this.add(logout);ImageIcon ic new ImageIcon(image\\exit.png);exit new JButton(ic);exit.setBounds(820, 550, 100, 45);exit.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {if (e.getSource() exit) {String[] options new String[] { 是, 否 };int n JOptionPane.showOptionDialog(null, 确定退出系统, 提示, JOptionPane.DEFAULT_OPTION,JOptionPane.WARNING_MESSAGE, null, options, options[0]);// 点击是的话直接退出if (n JOptionPane.YES_OPTION) {setVisible(false);System.exit(0);}}}});this.add(exit);this.add(new PartStudentTable().getpanel());this.add(new DormTable().getpanel());this.add(new GradeTable().getpanel());this.add(lab1);this.add(lab2);this.add(lab3);this.add(lab4);this.add(lab5);this.add(label);this.add(jpl);Image image this.getToolkit().getImage(image\\icon.png);this.setIconImage(image);this.setSize(960, 640); // 窗体的大小this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 关闭窗口this.setLocationRelativeTo(null);this.setVisible(true);}/*** 带有滚动效果的Label标签*/private class MoveLabel extends JLabel implements Runnable {private String text null;private Thread thread null;private int x 0;private int w 0, h 0;public MoveLabel(String text) {super(text);this.text text;thread new Thread(this);thread.start();}public String getText() {return text;}public void setText(String text) {super.setText(text);this.text text;}protected void paintComponent(Graphics g) {super.paintComponent(g);g.setColor(this.getBackground());g.fillRect(0, 0, w this.getWidth(), h this.getHeight());g.setColor(this.getForeground());g.setFont(this.getFont());g.drawString(text, x, h - 2);}public void run() {while (true) {x - 2;if (x -w) {x w;}this.repaint();try {Thread.sleep(50);} catch (InterruptedException e) {e.printStackTrace();}}}}
}七、联系与交流
q:969060742 完整代码、sql、文档、程序资源