The Employees Management System is a Java-based desktop application designed to streamline employee management tasks, including attendance tracking, payroll computation, and record updates. The application uses Java Swing for the graphical user interface and MySQL for data storage, providing a secure and user-friendly solution for managing workforce data.
This project is structured into modular components to enhance code readability, maintainability, and scalability.
- Home Interface: Serves as the main navigation hub.
- Admin Portal:
- Add, update, and delete employee records.
- View detailed employee data.
- Employee Portal:
- Login and registration.
- Log work hours.
- View personal details.
- Automatic salary calculation based on logged hours (rate: $40/hour).
- User Authentication:
- Secure login and password protection.
- New user registration.
- Data Management:
- Perform CRUD (Create, Read, Update, Delete) operations on employee records.
- Payroll Management:
- Log and calculate work hours.
- Generate real-time salary updates.
The project is divided into the following packages:
Holds configuration utilities for customizing the GUI and ensuring consistent design:
ButtonCustomizer
: A utility class for styling buttons.Schema
: Provides common window properties for all frames.
Contains the main JFrame
classes for application windows:
CheckFrame
ControlFrame
DeleteFrame
DetailsFrame
HomeFrame
HoursFrame
IntFrame
LoginFrame
SignupFrame
UpdateFrame
Manages application-wide data:
Data
: A central class to handle session data and facilitate database operations.
Includes JPanel
classes, each associated with its respective JFrame
:
CheckPanel
ControlPanel
DeletePanel
DetailsPanel
HomePanel
HoursPanel
IntPanel
LoginPanel
SignupPanel
UpdatePanel
The entry point of the application.
-
Database: MySQL
-
Table:
employee_table
- Schema:
CREATE TABLE employee_table ( id INT PRIMARY KEY, name VARCHAR(255), department VARCHAR(255), phone BIGINT, password VARCHAR(255), hours INT, salary DOUBLE );
- Schema:
-
Database Connection: The database connection is established using the MySQL Connector/J library. Update the connection string in the
Data
class if needed:String url = "jdbc:mysql://localhost:3306/employee"; String username = "root"; String password = "root";
- MVC (Model-View-Controller):
- Models: Data handling (
Data
class). - Views: Frames and panels.
- Controllers: Action listeners for user interaction.
- Models: Data handling (
- Separation of Concerns:
- Panels and frames are separated to facilitate modular design and reusability.
- Java Development Kit (JDK): Version 8 or higher.
- MySQL Server: Version 8.0 or higher.
- MySQL Connector/J: Latest version for database connectivity.
- Install and start MySQL Server.
- Create the
employee
database:CREATE DATABASE employee;
- Create the
employee_table
as per the schema provided above.
- Download here.
- Add the
.jar
file to your project:- If using an IDE (e.g., IntelliJ, Eclipse): Add the
.jar
as an external library. - If using the command line: Place the
.jar
in alib
folder and reference it during compilation and execution.
- If using an IDE (e.g., IntelliJ, Eclipse): Add the
Ensure the MySQL Connector/J is added to your project classpath.
Using an IDE:
- Import the project and configure the classpath to include MySQL Connector/J.
Using the command line:
# Navigate to the project directory
cd employees-management-system
# Compile the code
javac -cp "lib/*" src/main/*.java -d out
# Run the compiled application
java -cp "out:lib/*" main.Main
- Launch the application.
- Choose between the Admin or Employee portal.
- Perform actions such as logging in, registering, managing records, or logging hours.
This project is licensed under the MIT License. See the LICENSE
file for details.