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 浏览: 10
根据异常信息,空指针异常是在 `EmployeeListView.java` 文件的 `EmployeeListView` 构造方法中被抛出的,这个构造方法在第 27 行被调用。由于你没有提供 `EmployeeListView.java` 文件的代码,我无法确定具体出现了什么问题。但是,可能的原因是你在构造方法中使用了一个空对象或变量。你可以检查该构造方法,看看是否有可能出现空指针异常。如果你提供了 `EmployeeListView.java` 文件的代码,我可以帮你更好地解决问题。
相关问题
the import com.goole cannot be resolved
It seems that you have a typo in the import statement. The correct import statement for the Google package should be:
```java
import com.google.*;
```
Make sure that you have spelled "Google" correctly and that you have the appropriate dependencies and libraries installed in your project. If you are still having trouble with this issue, please provide more details about your specific situation and I'll do my best to help you.
package com.osnav.application;
这是一个Java程序中的包声明语句,它表示该程序中的所有类都属于com.osnav.application这个包。通常在编写Java程序时,为了避免命名冲突,会将相关的类放在同一个包中,这样就可以使用包名来区分不同的类。在Java中,包名通常使用小写字母,多个单词之间用点号(.)连接。例如,com.osnav.application可以拆分为com(公司域名)、osnav(公司名)和application(应用名)。而在具体的Java类中,需要使用import语句引入其他包中的类,才能在代码中使用。