Eclipse+Java+Swing实现学校教务管理系统(下)

简介: Eclipse+Java+Swing实现学校教务管理系统

UserInfo.java

package com.sjsq.entity;
/**
 * 
 * @author HZBIN1993
 * 
 * @author shuijianshiqing
 * 
 * @date 2021-01-09
 *
 */
public class UserInfo {
  private int ID;
  private String nickName;
  private String UserName;
  private String UserPass;
  private int Grade;
  public UserInfo() {
    super();
  }
  public UserInfo(int iD, String userName) {
    super();
    ID = iD;
    UserName = userName;
  }
  public String getNickName() {
    return nickName;
  }
  public void setNickName(String nickName) {
    this.nickName = nickName;
  }
  public int getID() {
    return ID;
  }
  public void setID(int iD) {
    ID = iD;
  }
  public String getUserName() {
    return UserName;
  }
  public void setUserName(String userName) {
    UserName = userName;
  }
  public String getUserPass() {
    return UserPass;
  }
  public void setUserPass(String userPass) {
    UserPass = userPass;
  }
  public int getGrade() {
    return Grade;
  }
  public void setGrade(int grade) {
    Grade = grade;
  }
  @Override
  public String toString() {
    // Auto-generated method stub
    String grade = "学生";
    if (Grade == 0) {
      grade = "教务人员";
    } else if (Grade == 1) {
      grade = "教师";
    }
    return "ID:  " + ID + ",用户名为:  " + UserName + "权限为:  " + grade;
  }
}

DAOFactory.java

package com.sjsq.factory;
import com.sjsq.dao.IArrangeInfoDao;
import com.sjsq.dao.IClassInfoDao;
import com.sjsq.dao.ICourseInfoDao;
import com.sjsq.dao.IScoreInfoDao;
import com.sjsq.dao.IStudentInfoDao;
import com.sjsq.dao.ITeacherInfoDao;
import com.sjsq.dao.IUserInfoDAO;
import com.sjsq.proxy.ArrangeInfoDaoImpIPoxy;
import com.sjsq.proxy.ClassInfoDaoImpIPoxy;
import com.sjsq.proxy.CourseInfoDaoImpIProxy;
import com.sjsq.proxy.ScoreInfoDaoImpIProxy;
import com.sjsq.proxy.StudentInfoDaoImpIProxy;
import com.sjsq.proxy.TeacherInfoDaoImpIProxy;
import com.sjsq.proxy.UserInfoDaoImpIProxy;
/**
 * 创建工厂类
 * 
 * @author Administrator
 * 
 */
public class DAOFactory {
  public static IUserInfoDAO getIUserDAOInstance() {
    // 用户信息操作工厂
    return new UserInfoDaoImpIProxy();
  }
  public static IScoreInfoDao getScoreDAOInstance() {
    // 成绩操作工厂
    return new ScoreInfoDaoImpIProxy();
  }
  public static ICourseInfoDao getCourseDAOInstance() {
    // 课程操作工厂
    return new CourseInfoDaoImpIProxy();
  }
  public static IStudentInfoDao getStudentDAOInstance() {
    // 学生操作工厂
    return new StudentInfoDaoImpIProxy();
  }
  public static IClassInfoDao getClassDAOInstance() {
    // 班级操作工厂
    return new ClassInfoDaoImpIPoxy();
  }
  public static ITeacherInfoDao getTeacherDAOInstance() {
    // 老师操作工厂
    return new TeacherInfoDaoImpIProxy();
  }
  public static IArrangeInfoDao getArrangeDaoInstance() {
    // 选课信息操作工厂
    return new ArrangeInfoDaoImpIPoxy();
  }
}

UserInfoDaoImpIProxy.java

package com.sjsq.proxy;
import java.util.List;
import com.sjsq.dao.IUserInfoDAO;
import com.sjsq.dao.ImpI.UserInfoDaoImpI;
import com.sjsq.dbConnect.DataBaseConn;
import com.sjsq.entity.UserInfo;
/**
 * 用户信息代理类
 * 
 * @author shuijianshiqing
 * 
 * 
 *
 */
public class UserInfoDaoImpIProxy implements IUserInfoDAO {
  private DataBaseConn dbc = null;
  private IUserInfoDAO dao = null;
  public UserInfoDaoImpIProxy() {
    dbc = new DataBaseConn();
    dao = new UserInfoDaoImpI(dbc.getConnection());
  }
  @Override
  public boolean doCreate(UserInfo user) throws Exception {
    // 增加用户信息(代理实现)
    boolean flag = true;
    try {
      flag = this.dao.doCreate(user);
    } catch (Exception e) {
      throw e;
    } finally {
      this.dbc.close();
    }
    return flag;
  }
  @Override
  public boolean doUpdate(UserInfo user) throws Exception {
    // 更新用户信息(代理实现)
    boolean flag = true;
    try {
      flag = this.dao.doUpdate(user);
    } catch (Exception e) {
      throw e;
    } finally {
      this.dbc.close();
    }
    return flag;
  }
  @Override
  public boolean doDelete(String username) throws Exception {
    // 删除用户信息(代理实现)
    boolean flag = true;
    try {
      flag = this.dao.doDelete(username);
    } catch (Exception e) {
      throw e;
    } finally {
      this.dbc.close();
    }
    return flag;
  }
  @Override
  public List<UserInfo> findAll(String keyword) throws Exception {
    // 查找用户信息-关键字查找(代理实现)
    List<UserInfo> all = null;
    try {
      all = this.dao.findAll(keyword);
    } catch (Exception e) {
      throw e;
    } finally {
      this.dbc.close();
    }
    return all;
  }
  @Override
  public UserInfo findById(String id) throws Exception {
    // 查找用户信息-ID查找(代理实现)
    UserInfo user = null;
    try {
      user = this.dao.findById(id);
    } catch (Exception e) {
      throw e;
    } finally {
      this.dbc.close();
    }
    return user;
  }
}

DateUtil.java

package com.sjsq.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class DateUtil {
  public static String getAfterDay(String date, int num) {
    SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
    Date dt = null;
    try {
      dt = parser.parse(date);
    } catch (ParseException e) {
      e.printStackTrace();
    }
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(dt);
    calendar.add(Calendar.DATE, num);
    SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
    return simpledateformat.format(calendar.getTime());
  }
  public static String getBeforeDate(int num) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(new Date());
    calendar.add(Calendar.DATE, -num);
    SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
    return simpledateformat.format(calendar.getTime());
  }
  public static String getDate() {
    Date dt = new Date();
    long tmLong = dt.getTime();
    return (new java.sql.Date(tmLong)).toString();
  }
  public static String getDateTime() {
    Date dt = new Date();
    Long tmLong = dt.getTime();
    return (new java.sql.Date(tmLong) + " " + (new java.sql.Time(tmLong))).toString();
  }
  public static java.sql.Date getStringToDate(String day) {
    SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd");
    Date dt = new Date();
    try {
      dt = parser.parse(day);
    } catch (ParseException e) {
      e.printStackTrace();
    }
    return (new java.sql.Date(dt.getTime()));
  }
}

Login.java

package com.sjsq.window;
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemColor;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ButtonGroup;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.LayoutStyle.ComponentPlacement;
import com.sjsq.entity.UserInfo;
import com.sjsq.factory.DAOFactory;
import com.sjsq.util.GlobalUser;
/**
 * 
 * 登录
 * 
 * @author shuijianshiqing
 *
 * @date 2021-01-09 20:42
 *
 */
public class Login extends JFrame {
  private final Action action = new SwingAction();
  private JTextField textField;
  private final ButtonGroup buttonGroup = new ButtonGroup();
  private JPasswordField passwordField;
  private JRadioButton rdbtnNewRadioButton = null;
  private JRadioButton rdbtnNewRadioButton_1 = null;
  private JRadioButton rdbtnNewRadioButton_2 = null;
  public Login() {
    setResizable(false);
    getContentPane().setBackground(SystemColor.menu);
    setSize(new Dimension(341, 410));
    setTitle("教务管理系统");
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    JMenu mnFile = new JMenu("菜单");
    mnFile.setFont(new Font("微软雅黑", Font.PLAIN, 16));
    menuBar.add(mnFile);
    JMenuItem mntmNewMenuItem = new JMenuItem("退出");
    mntmNewMenuItem.setFont(new Font("微软雅黑", Font.PLAIN, 16));
    mntmNewMenuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.exit(0);
      }
    });
    mntmNewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_STOP, 0));
    mnFile.add(mntmNewMenuItem);
    JMenu mnHelp = new JMenu("帮助");
    mnHelp.setFont(new Font("微软雅黑", Font.PLAIN, 16));
    menuBar.add(mnHelp);
    JMenuItem mntmNewMenuItem_1 = new JMenuItem("关于");
    mntmNewMenuItem_1.setFont(new Font("微软雅黑", Font.PLAIN, 16));
    mntmNewMenuItem_1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_1actionPerformed(e);
      }
    });
    mnHelp.add(mntmNewMenuItem_1);
    JLabel lblNewLabel = new JLabel("New label");
    lblNewLabel.setIcon(new ImageIcon(Login.class.getResource("/images/login.jpg")));
    JLabel lblNewLabel_1 = new JLabel("账号");
    JLabel lblNewLabel_2 = new JLabel("密码");
    textField = new JTextField();
    textField.setColumns(0);
    rdbtnNewRadioButton = new JRadioButton("学生");
    rdbtnNewRadioButton.setSelected(true);
    buttonGroup.add(rdbtnNewRadioButton);
    rdbtnNewRadioButton_1 = new JRadioButton("教师");
    buttonGroup.add(rdbtnNewRadioButton_1);
    rdbtnNewRadioButton_2 = new JRadioButton("教务人员");
    buttonGroup.add(rdbtnNewRadioButton_2);
    JButton btnNewButton = new JButton("登录");
    btnNewButton.setDoubleBuffered(true);
    btnNewButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        btnNewButtonactionPerformed(event);
      }
    });
    JButton btnNewButton_1 = new JButton("取消");
    btnNewButton_1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        System.exit(0);
      }
    });
    passwordField = new JPasswordField();
    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
        .createSequentialGroup().addGap(70)
        .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup()
                .addComponent(lblNewLabel_2, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
                .addGap(8).addComponent(passwordField, 166, 166, 166))
            .addGroup(groupLayout.createSequentialGroup().addComponent(rdbtnNewRadioButton).addGap(18)
                .addComponent(rdbtnNewRadioButton_1).addPreferredGap(ComponentPlacement.UNRELATED)
                .addComponent(rdbtnNewRadioButton_2))
            .addGroup(groupLayout.createSequentialGroup().addComponent(lblNewLabel_1).addGap(18)
                .addComponent(textField, GroupLayout.PREFERRED_SIZE, 166, GroupLayout.PREFERRED_SIZE)))
        .addContainerGap(18, Short.MAX_VALUE))
        .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 341, Short.MAX_VALUE)
        .addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup().addContainerGap(82, Short.MAX_VALUE)
            .addComponent(btnNewButton).addGap(27).addComponent(btnNewButton_1).addGap(118)));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
        .createSequentialGroup()
        .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 170, GroupLayout.PREFERRED_SIZE).addGap(18)
        .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblNewLabel_1).addComponent(
            textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        .addPreferredGap(ComponentPlacement.RELATED)
        .addGroup(groupLayout
            .createParallelGroup(Alignment.BASELINE).addComponent(lblNewLabel_2).addComponent(passwordField,
                GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        .addGap(18)
        .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(rdbtnNewRadioButton_2)
            .addComponent(rdbtnNewRadioButton_1).addComponent(rdbtnNewRadioButton))
        .addGap(18).addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(btnNewButton_1)
            .addComponent(btnNewButton))
        .addContainerGap(40, Short.MAX_VALUE)));
    getContentPane().setLayout(groupLayout);
    addTrayIcon();
  }
  // 给心痛托盘区添加图标
  private void addTrayIcon() {
    // Auto-generated method stub
    SystemTray st = SystemTray.getSystemTray();
    if (SystemTray.isSupported()) {
      URL imgurl = this.getClass().getClassLoader().getResource("images/login_main.jpg");
      Image img = Toolkit.getDefaultToolkit().createImage(imgurl);
      // Image
      // img=Toolkit.getDefaultToolkit().createImage("images/aboutme.jpg");
      PopupMenu popup = new PopupMenu();
      MenuItem item = new MenuItem("退出程序");
      item.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
          // Auto-generated method stub
          System.exit(0);
        }
      });
      popup.add(item);
      TrayIcon icon = new TrayIcon(img, "教务管理系统", popup);
      icon.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
          if (e.getClickCount() == 2) {
            UserInfo u = GlobalUser.LOGIN_USER;
            if (u == null) {
              Login.start();
            } else if (u.getGrade() == 0) {
              AdminFrame.start();
            } else if (u.getGrade() == 1) {
              TeacherFrame.start();
            } else if (u.getGrade() == 2) {
              StudentFrame.start();
            }
          }
        }
      });
      icon.setImageAutoSize(true);
      try {
        st.add(icon);
      } catch (AWTException e1) {
        e1.printStackTrace();
      }
    }
  }
  protected void mntmNewMenuItem_1actionPerformed(ActionEvent e) {
    About.start();
  }
  protected void btnNewButtonactionPerformed(ActionEvent event) {
    String name = textField.getText();// 获得用户名
    String pass = String.valueOf(passwordField.getPassword());
    UserInfo user = null;
    // 未输入用户名
    if (name.equals("")) {
      JOptionPane.showMessageDialog(this, "用户名不允许为空!", "提示", 2);
      return;
    }
    try {
      user = DAOFactory.getIUserDAOInstance().findById(name);
      // System.out.println(user);
      if (user != null) {
        if (user.getUserPass() != null && user.getUserPass().equals(pass)) {
          GlobalUser.LOGIN_USER = user; // 记录当前用户
          // 进入主界面
          if (rdbtnNewRadioButton.isSelected()) {
            if (user.getGrade() != 2) {
              JOptionPane.showMessageDialog(this, "该用户不是学生!", "消息", 2);
              return;
            }
            // 学生界面
            StudentFrame.start();
          } else if (rdbtnNewRadioButton_1.isSelected()) {
            if (user.getGrade() != 1) {
              JOptionPane.showMessageDialog(this, "该用户不是老师!", "消息", 2);
              return;
            }
            // 教师界面
            TeacherFrame.start();
          } else if (rdbtnNewRadioButton_2.isSelected()) {
            if (user.getGrade() != 0) {
              JOptionPane.showMessageDialog(this, "该用户不是教务人员!", "消息", 2);
              return;
            }
            // 教务人员界面
            AdminFrame.start();
          } else {
            JOptionPane.showMessageDialog(this, "别急!权限没选呢");
            return;
          }
          this.dispose();
        } else {
          JOptionPane.showMessageDialog(this, "用户名或密码错误!", "消息", 2);
          return;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    if (user == null) {
      JOptionPane.showMessageDialog(this, "用户名或密码错误!", "消息", 0);
      return;
    }
  }
  private class SwingAction extends AbstractAction {
    public SwingAction() {
      putValue(NAME, "SwingAction");
      putValue(SHORT_DESCRIPTION, "Some short description");
    }
    public void actionPerformed(ActionEvent e) {
    }
  }
  public static void start() {
    java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
        new Login().setVisible(true);
      }
    });
  }
  public static void main(String[] args) {
    new Login().setVisible(true);
  }
}

AdminFrame.java

package com.sjsq.window;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.IOException;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import com.sjsq.util.DateUtil;
import com.sjsq.util.GlobalUser;
import com.sjsq.util.imageUtils;
import com.sjsq.util.msgUtils;
import java.awt.Color;
import java.awt.Font;
public class AdminFrame extends JFrame {
  private JLabel lblNewLabel_3;
  private JLabel lblNewLabel_1;
  private JLabel lblNewLabel_2;
  private JLabel lblNewLabel;
  /**
   * 
   */
  private static final long serialVersionUID = 1L;
  public AdminFrame() {
    setResizable(false);
    setTitle("教务管理系统---教务人员");
    setSize(new Dimension(800, 500));
    setLocationRelativeTo(null);
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    JMenu mnNewMenu = new JMenu("工具");
    menuBar.add(mnNewMenu);
    JMenu menu_1 = new JMenu("系统工具");
    mnNewMenu.add(menu_1);
    JMenuItem mntmNewMenuItem_24 = new JMenuItem("cmd");
    mntmNewMenuItem_24.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        mntmNewMenuItem_24actionPerformed(event);
      }
    });
    menu_1.add(mntmNewMenuItem_24);
    JMenuItem mntmNewMenuItem_25 = new JMenuItem("截图");
    mntmNewMenuItem_25.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        mntmNewMenuItem_25actionPerformed(event);
      }
    });
    menu_1.add(mntmNewMenuItem_25);
    JMenuItem mntmNewMenuItem_26 = new JMenuItem("画图");
    mntmNewMenuItem_26.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        mntmNewMenuItem_26actionPerformed(event);
      }
    });
    menu_1.add(mntmNewMenuItem_26);
    JMenuItem mntmNewMenuItem_27 = new JMenuItem("键盘");
    mntmNewMenuItem_27.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        mntmNewMenuItem_27actionPerformed(event);
      }
    });
    menu_1.add(mntmNewMenuItem_27);
    JMenuItem mntmNewMenuItem_28 = new JMenuItem("记事本");
    mntmNewMenuItem_28.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        mntmNewMenuItem_28actionPerformed(event);
      }
    });
    menu_1.add(mntmNewMenuItem_28);
    JMenuItem mntmNewMenuItem_29 = new JMenuItem("计算器");
    mntmNewMenuItem_29.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        mntmNewMenuItem_29actionPerformed(event);
      }
    });
    menu_1.add(mntmNewMenuItem_29);
    JMenuItem mntmNewMenuItem_2 = new JMenuItem("系统信息");
    mntmNewMenuItem_2.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_2actionPerformed(e);
      }
    });
    mnNewMenu.add(mntmNewMenuItem_2);
    JMenuItem mntmNewMenuItem_3 = new JMenuItem("系统版本");
    mntmNewMenuItem_3.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_3actionPerformed(e);
      }
    });
    mnNewMenu.add(mntmNewMenuItem_3);
    JMenuItem mntmNewMenuItem_4 = new JMenuItem("退出");
    mntmNewMenuItem_4.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        mntmNewMenuItem_4actionPerformed(event);
      }
    });
    mnNewMenu.add(mntmNewMenuItem_4);
    JMenu mnNewMenu_1 = new JMenu("通知");
    menuBar.add(mnNewMenu_1);
    JMenuItem menuItem_1 = new JMenuItem("管理通知");
    menuItem_1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        menuItem_1actionPerformed(e);
      }
    });
    mnNewMenu_1.add(menuItem_1);
    JMenu mnNewMenu_2 = new JMenu("成绩管理");
    menuBar.add(mnNewMenu_2);
    JMenuItem mntmNewMenuItem_6 = new JMenuItem("成绩管理");
    mntmNewMenuItem_6.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_6actionPerformed(e);
      }
    });
    mnNewMenu_2.add(mntmNewMenuItem_6);
    JMenu mnNewMenu_3 = new JMenu("用户管理");
    menuBar.add(mnNewMenu_3);
    JMenuItem menuItem_2 = new JMenuItem("退出");
    menuItem_2.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        menuItem_2addActionListener(e);
      }
    });
    JMenuItem menuItem_3 = new JMenuItem("学生管理");
    menuItem_3.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        menuItem_3actionPerformed(e);
      }
    });
    mnNewMenu_3.add(menuItem_3);
    JMenuItem mntmNewMenuItem_8 = new JMenuItem("教师管理");
    mntmNewMenuItem_8.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_8actionPerformed(e);
      }
    });
    mnNewMenu_3.add(mntmNewMenuItem_8);
    JMenuItem mntmNewMenuItem_7 = new JMenuItem("教务人员");
    mntmNewMenuItem_7.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_7actionPerformed(e);
      }
    });
    mnNewMenu_3.add(mntmNewMenuItem_7);
    mnNewMenu_3.add(menuItem_2);
    JMenu mnNewMenu_4 = new JMenu("课程管理");
    menuBar.add(mnNewMenu_4);
    JMenuItem mntmNewMenuItem_11 = new JMenuItem("安排课程");
    mntmNewMenuItem_11.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_11actionPerformed(e);
      }
    });
    mnNewMenu_4.add(mntmNewMenuItem_11);
    JMenuItem mntmNewMenuItem_12 = new JMenuItem("课程管理");
    mntmNewMenuItem_12.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_12actionPerformed(e);
      }
    });
    mnNewMenu_4.add(mntmNewMenuItem_12);
    JMenu menu_2 = new JMenu("班级管理");
    menuBar.add(menu_2);
    JMenuItem mntmNewMenuItem_9 = new JMenuItem("班级管理");
    mntmNewMenuItem_9.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_9actionPerformed(e);
      }
    });
    menu_2.add(mntmNewMenuItem_9);
    JMenu menu = new JMenu("帮助");
    menuBar.add(menu);
    JMenuItem mntmNewMenuItem = new JMenuItem("关于");
    mntmNewMenuItem.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        About.start();
      }
    });
    menu.add(mntmNewMenuItem);
    JMenuItem mntmNewMenuItem_1 = new JMenuItem("帮助");
    mntmNewMenuItem_1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        mntmNewMenuItem_1actionPerformed(e);
      }
    });
    menu.add(mntmNewMenuItem_1);
    lblNewLabel = new JLabel("");
    // 设置变换图片
    imageUtils changeimg = new imageUtils(lblNewLabel);
    changeimg.start();
    lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
    lblNewLabel_1 = new JLabel("");
    lblNewLabel_1.setHorizontalAlignment(SwingConstants.LEFT);
    // 设置当前用户
    lblNewLabel_1.setText(GlobalUser.LOGIN_USER.getNickName() + "(" + GlobalUser.LOGIN_USER.getUserName() + ")");
    lblNewLabel_2 = new JLabel("");
    lblNewLabel_2.setHorizontalAlignment(SwingConstants.LEFT);
    lblNewLabel_3 = new JLabel("");
    lblNewLabel_3.setFont(new Font("宋体", Font.PLAIN, 14));
    lblNewLabel_3.setForeground(Color.RED);
    // 设置提示信息
    msgUtils msg = new msgUtils(lblNewLabel_3);
    msg.start();
    // 设置时间
    new Thread() {
      public void run() {
        while (true) {
          lblNewLabel_2.setText(DateUtil.getDateTime());
          try {
            Thread.sleep(1000);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        }
      };
    }.start();
    lblNewLabel_3.setHorizontalAlignment(SwingConstants.CENTER);
    JLabel label = new JLabel("当前用户:");
    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
        .addGroup(groupLayout.createSequentialGroup().addContainerGap()
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                .addGroup(groupLayout.createSequentialGroup().addGap(10).addComponent(lblNewLabel_3,
                    GroupLayout.DEFAULT_SIZE, 764, Short.MAX_VALUE))
                .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 766, GroupLayout.PREFERRED_SIZE)
                .addGroup(groupLayout.createSequentialGroup().addGap(176).addComponent(label)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 213,
                        GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(lblNewLabel_2, GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)))
            .addContainerGap()));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
        .createSequentialGroup().addContainerGap()
        .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
            .addComponent(lblNewLabel_2, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
            .addComponent(label)
            .addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE))
        .addPreferredGap(ComponentPlacement.RELATED)
        .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 345, GroupLayout.PREFERRED_SIZE)
        .addPreferredGap(ComponentPlacement.UNRELATED)
        .addComponent(lblNewLabel_3, GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE)));
    getContentPane().setLayout(groupLayout);
  }
  protected void menuItem_1actionPerformed(ActionEvent e) {
    // TODO 通知管理
  }
  protected void mntmNewMenuItem_7actionPerformed(ActionEvent e) {
    // 教务人员
    ManagerAdmin.start();
  }
  protected void mntmNewMenuItem_8actionPerformed(ActionEvent e) {
    // 教师管理
    ManagerTeach.start();
  }
  protected void menuItem_3actionPerformed(ActionEvent e) {
    // 学生管理
    ManagerStu.start();
  }
  protected void mntmNewMenuItem_12actionPerformed(ActionEvent e) {
    // 课程管理
    ManagerCourse.start();
  }
  protected void mntmNewMenuItem_11actionPerformed(ActionEvent e) {
    // 排课
    ArrangeCourse.start();
  }
  protected void mntmNewMenuItem_1actionPerformed(ActionEvent e) {
    // TODO 帮助
  }
  protected void mntmNewMenuItem_9actionPerformed(ActionEvent e) {
    // 班级管理
    ManagerClass.start();
  }
  protected void mntmNewMenuItem_6actionPerformed(ActionEvent e) {
    // 成绩管理
    ManagerScore.start();
  }
  protected void mntmNewMenuItem_29actionPerformed(ActionEvent event) {
    // 打开计算器
    try {
      Runtime.getRuntime().exec("cmd /c start  CALC");
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  protected void mntmNewMenuItem_28actionPerformed(ActionEvent event) {
    // 打开记事本
    try {
      Runtime.getRuntime().exec("cmd /c start  notepad");
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  protected void mntmNewMenuItem_27actionPerformed(ActionEvent event) {
    // 打开屏幕键盘
    try {
      Runtime.getRuntime().exec("cmd /c start  osk");
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  protected void mntmNewMenuItem_26actionPerformed(ActionEvent event) {
    // 打开画图板
    try {
      Runtime.getRuntime().exec("cmd /c start  mspaint");
    } catch (IOException exc) {
      exc.printStackTrace();
    }
  }
  protected void mntmNewMenuItem_25actionPerformed(ActionEvent event) {
    // 打开截图
    try {
      Runtime.getRuntime().exec("cmd /c start  snippingtool");
    } catch (IOException exc) {
      exc.printStackTrace();
    }
  }
  protected void mntmNewMenuItem_24actionPerformed(ActionEvent event) {
    // 打开cmd
    try {
      Runtime.getRuntime().exec("cmd /c start  cmd");
    } catch (IOException exc) {
      exc.printStackTrace();
    }
  }
  protected void mntmNewMenuItem_2actionPerformed(ActionEvent e) {
    // 系统信息
    OsINF.start();
  }
  protected void mntmNewMenuItem_3actionPerformed(ActionEvent e) {
    // 检测系统版本
    try {
      Runtime.getRuntime().exec("cmd /c start  winver");
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }
  protected void menuItem_2addActionListener(ActionEvent e) {
    this.dispose();
    Login.start();
  }
  protected void mntmNewMenuItem_4actionPerformed(ActionEvent event) {
    System.exit(1);
  }
  public static void start() {
    java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
        new AdminFrame().setVisible(true);
      }
    });
  }
}


四、其他


1.其他系统实现


JavaWeb系统系列实现

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

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

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

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

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

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

Java+Springboot+H-ui实现营销管理系统

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


JavaSwing系统系列实现

Java+Swing实现斗地主游戏

Java+Swing实现图书管理系统

Java+Swing实现医院管理系统

Java+Swing实现仓库管理系统

Java+Swing实现考试管理系统

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

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

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

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

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

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

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

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

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

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

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

Java+Swing实现超市管理系统-TXT存储信息

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



相关文章
|
3月前
|
安全 Java API
|
4月前
|
JavaScript Java 测试技术
基于Java的人事管理系统设计和实现(源码+LW+部署讲解)
基于Java的人事管理系统设计和实现(源码+LW+部署讲解)
86 7
|
4月前
|
JavaScript Java 测试技术
基于Java的儿童福利院管理系统设计和实现(源码+LW+部署讲解)
基于Java的儿童福利院管理系统设计和实现(源码+LW+部署讲解)
92 7
|
3月前
|
SQL Java 数据库连接
【Java】Java Swing 图书管借阅管理系统(源码+论文)【独一无二】
【Java】Java Swing 图书管借阅管理系统(源码+论文)【独一无二】
138 0
|
3月前
|
存储 数据可视化 Java
【Java】Java swing 民宿管理系统 GUI(源码+可视化界面)【独一无二】
【Java】Java swing 民宿管理系统 GUI(源码+可视化界面)【独一无二】
|
4月前
|
Java 关系型数据库 MySQL
班级通讯录管理系统(Java+MySQL)
构建了一个Java Swing应用,搭配MySQL,实现班级通讯录管理。系统具备管理员登录、班级与学生信息的增删改查功能,每个班级窗口独立且自适应布局。利用GBK编码处理中文,JDBC连接数据库,优化窗口复用和代码结构,数据变更实时同步。示例截图展示详细界面。
班级通讯录管理系统(Java+MySQL)
|
4月前
|
JavaScript 前端开发 Java
Java数字化产科管理系统源码,多家医院应用案例,可直接上项目
Java开发的数字化产科管理系统,已在多家医院实施,支持直接部署。系统涵盖孕产全程,包括门诊、住院、统计和移动服务,整合高危管理、智能提醒、档案追踪等功能,与HIS等系统对接。采用前后端分离架构,Java语言,Vue前端,若依框架,MySQL数据库。优势在于提升就诊效率,降低漏检率,自动报表生成,减少重复工作,支持数据研究,并实现医院与卫计委平台的数据互通,打造全生育周期健康服务。
65 4
|
4月前
|
存储 Oracle Java
Java面试题:描述如何使用Eclipse或IntelliJ IDEA进行Java开发?
Java面试题:描述如何使用Eclipse或IntelliJ IDEA进行Java开发?
47 0
|
4月前
|
关系型数据库 MySQL 数据库连接
解决在eclipse2021中,用mysql-connector-java-8.0.18.jar不兼容,导致无法访问数据库问题
解决在eclipse2021中,用mysql-connector-java-8.0.18.jar不兼容,导致无法访问数据库问题
107 0
|
6月前
|
Java Android开发
在Eclipse环境下调试Java程序
在Eclipse环境下调试Java程序
76 1