package com.enterprise; import com.enterprise.controller.AttendanceController; import com.enterprise.controller.EmployeeController; import com.enterprise.controller.EmployeeListController; import com.enterprise.dao.AttendanceDAO; import com.enterprise.dao.EmployeeDAO; import com.enterprise.view.AttendanceView; import com.enterprise.view.EmployeeListView; import com.enterprise.view.EmployeeView; import javax.swing.*; /** * @Author: 羽赫 * @Description: */ public class Main { public static void main(String[] args) { // database connection information String url = "jdbc:mysql://localhost:3307/enterprise"; String user = "root"; String password = "123456"; // create database access objects EmployeeDAO employeeDAO = new EmployeeDAO(url, user, password); AttendanceDAO attendanceDAO = new AttendanceDAO(url, user, password); // create views EmployeeView employeeView = new EmployeeView(); EmployeeListView employeeListView = new EmployeeListView(); AttendanceView attendanceView = new AttendanceView(); // create controllers EmployeeController employeeController = new EmployeeController(employeeView, employeeDAO); EmployeeListController employeeListController = new EmployeeListController(employeeListView, employeeDAO); AttendanceController attendanceController = new AttendanceController(attendanceView, attendanceDAO); // create main frame and add views JFrame frame = new JFrame("Enterprise Attendance System"); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab("Add Employee", employeeView); tabbedPane.addTab("Employee List", employeeListView); tabbedPane.addTab("Attendance Records", attendanceView); frame.add(tabbedPane); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }
时间: 2024-04-07 20:32:32 浏览: 101
根据异常信息,空指针异常是在 `EmployeeListView.java` 文件的 `EmployeeListView` 构造方法中被抛出的,这个构造方法在第 27 行被调用。由于你没有提供 `EmployeeListView.java` 文件的代码,我无法确定具体出现了什么问题。但是,可能的原因是你在构造方法中使用了一个空对象或变量。你可以检查该构造方法,看看是否有可能出现空指针异常。如果你提供了 `EmployeeListView.java` 文件的代码,我可以帮你更好地解决问题。
阅读全文