You are on page 1of 16

INTRODUCTION

The Employee Management System has been developed to overcome the


problems in the manual system’s operation. This software is supported to
eliminate and, in some cases, reduce the complexity of the current system. In
addition, the program is designed to meet the company's special needs to operate
efficiently and effectively. The application is minimized as much as possible to
avoid errors during data entry. It also gives an error message while entering invalid
data. The user does not need to have official information to use this program. So,
all of this seems easy to use. An employee leave management system, as described
above, can lead to a flawless, secure, reliable, and fast management system. It may
help the user to focus on other tasks rather than keeping records. That way it will
help the organization to make better use of resources. Every organization, large or
small, faces the challenge of navigating and managing the details of leave,
employee, salary, type of leave, and salary. Each employee leave management
system has different employee needs, so we design special employee leave
management systems that fit your management needs. Designed to assist in
strategic planning, this will help ensure that your organization is equipped with
the right level of knowledge and details of your future goals. Also, for those busy
managers who are always on the move, our systems come with remote access
features, which will allow you to manage your employees at any time.
HARDWARE & SOFTWARE REQUIREMENT

• System: Intel i3 core (minimum)


• Hard Disk: 8GB (minimum)
• My SQL for database
• JAVA
• Swing
• AWT
ER Diagram
Graphical User Interface
Source Code

Login page:
package employee.management.system;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public class Login extends JFrame implements ActionListener{

JTextField input;
JTextField inpass;

Login(){
getContentPane().setBackground(Color.WHITE);
setLayout(null); //these is done to specify our own layout

JLabel log = new JLabel("Login");


log.setBounds(240,20,550,60);
log.setFont(new Font("serif",Font.BOLD,30));
add(log);

JLabel username = new JLabel("Username");


username.setBounds(40, 100, 80, 50);
add(username);

input = new JTextField();


input.setBounds(180, 110, 100, 30);
add(input);

JLabel password = new JLabel("Password");


password.setBounds(40, 150, 80, 50);
add(password);

inpass = new JTextField();


inpass.setBounds(180, 170, 100, 30);
add(inpass);

JButton login = new JButton("LOGIN");


login.setBounds(220, 250, 100, 30);
add(login);
login.addActionListener(this);

ImageIcon user = new


ImageIcon(ClassLoader.getSystemResource("icons/second.jpg"));
Image i1 = user.getImage().getScaledInstance(150, 150, Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i1);
JLabel userimage = new JLabel(i2);
userimage.setBounds(350,80 , 150, 150);
add(userimage);

setSize(550,350);
setLocation(400,65);
setVisible(true);
}

public void actionPerformed(ActionEvent ae){


try{
String user = input.getText(); //username input is extracted in the user
String pass = inpass.getText(); //password input is extracted in the pass
String query = "select * from login where username = '"+user+"' and password =
'"+pass+"'";
Conn c = new Conn();
ResultSet re = c.s.executeQuery(query);
if(re.next()){
setVisible(false);
new Home();
}else{
JOptionPane.showMessageDialog(null, "INVALID USERNAME OR
PASSWORD!!!");
// setVisible(false);
}
}catch(Exception e){
e.printStackTrace();
}
}

public static void main(String [] args){


new Login();
}
}
AddEmp:
package employee.management.system;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import com.toedter.calendar.JDateChooser;
import java.util.*;

public class AddEmp extends JFrame implements ActionListener {

Random ran = new Random();


int number = ran.nextInt(999999);
AddEmp(){
JLabel heading = new JLabel("Add Employee Details");
heading.setBounds(330, 40, 500, 50);
heading.setFont(new Font("Sanserif",Font.BOLD,25));
add(heading);

JLabel name = new JLabel("Name :");


name.setBounds(20, 120, 90, 90);
name.setFont(new Font("serif",Font.PLAIN,20));
add(name);

JTextField inname = new JTextField();


inname.setBounds(90, 150, 150, 30);
add(inname);

JLabel fname = new JLabel("Father's Name :");


fname.setBounds(280, 120, 150, 90);
fname.setFont(new Font("serif",Font.PLAIN,20));
add(fname);

JTextField infname = new JTextField();


infname.setBounds(410, 150, 150, 30);
add(infname);

JLabel lname = new JLabel("Last Name :");


lname.setBounds(590, 120, 150, 90);
lname.setFont(new Font("serif",Font.PLAIN,20));
add(lname);
JTextField inlname = new JTextField();
inlname.setBounds(690, 150, 150, 30);
add(inlname);

JLabel dob = new JLabel("Date of Birth :");


dob.setBounds(30, 175, 150, 90);
dob.setFont(new Font("serif",Font.PLAIN,20));
add(dob);

JDateChooser date = new JDateChooser();


date.setBounds(170, 205, 120, 30);
add(date);

JLabel salary = new JLabel("Salary ");


salary.setBounds(330, 175, 150, 90);
salary.setFont(new Font("serif",Font.PLAIN,20));
add(salary);

JTextField insalary = new JTextField();


insalary.setBounds(410, 205, 150, 30);
add(insalary);

JLabel address = new JLabel("Address ");


address.setBounds(50, 235, 150, 90);
address.setFont(new Font("serif",Font.PLAIN,20));
add(address);

JTextField inaddress = new JTextField();


inaddress.setBounds(160, 265, 190, 30);
add(inaddress);

JLabel cellno = new JLabel("Mobile No. ");


cellno.setBounds(400, 235, 150, 90);
cellno.setFont(new Font("serif",Font.PLAIN,20));
add(cellno);

JTextField incellno = new JTextField();


incellno.setBounds(500, 265, 150, 30);
add(incellno);

JLabel email = new JLabel("Email ");


email.setBounds(40, 300, 150, 90);
email.setFont(new Font("serif",Font.PLAIN,20));
add(email);
JTextField inemail = new JTextField();
inemail.setBounds(160, 330, 190, 30);
add(inemail);

// **********************************************
JLabel designation = new JLabel("Designation ");
designation.setBounds(40, 360, 150, 90);
designation.setFont(new Font("serif",Font.PLAIN,20));
add(designation);

JTextField indesignation = new JTextField();


indesignation.setBounds(160, 390, 190, 30);
add(indesignation);

JLabel labelempId = new JLabel("Employee id");


labelempId.setBounds(40, 450, 150, 30);
labelempId.setFont(new Font("serif", Font.PLAIN, 20));
add(labelempId);

JLabel lblempId = new JLabel("" + number);


lblempId.setBounds(220, 450, 150, 30);
lblempId.setFont(new Font("serif", Font.PLAIN, 20));
add(lblempId);

String degree[] =
{"PHD","B.Tech","M.Tech","BCA","MCA","BBA","MBA","M.Sc","B.Sc","B.com","M.co
m","BA","MA"};
JLabel edu = new JLabel("Higest Education ");
edu.setBounds(400, 390, 150, 30);
edu.setFont(new Font("serif" , Font.PLAIN,20));
add(edu);
// by using JComboBox and Choose class we can create dropdown menu.
JComboBox hedu = new JComboBox(degree);
hedu.setBounds(620, 390, 150, 30);
add(hedu);
hedu.setBackground(Color.white);
setLayout(null);
getContentPane().setBackground(Color.WHITE);
setSize(900,700);
setVisible(true);
setLocation(240,10);
}
public static void main(String args[]){
new AddEmp();
}
}
Home:
package employee.management.system;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Home extends JFrame implements ActionListener{


JButton add,update,remove,view;
Home(){
ImageIcon home = new
ImageIcon(ClassLoader.getSystemResource("icons/home.jpg"));
Image i2 = home.getImage().getScaledInstance(1120, 630, Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel homeimg = new JLabel(i3);
homeimg.setBounds(0,0,1120,630);
add(homeimg);

JLabel heading = new JLabel("Employee Management System");


heading.setBounds(620, 20, 450, 30);
heading.setFont(new Font("TAHOMA",Font.BOLD,25));
homeimg.add(heading);

add = new JButton("Add Employee");


add.setBounds(640, 80, 150, 40);
homeimg.add(add);
add.addActionListener(this);

remove = new JButton("Remove Employee");


remove.setBounds(820, 80, 150, 40);
homeimg.add(remove);
remove.addActionListener(this);

update = new JButton("Update Employee");


update.setBounds(640, 150, 150, 40);
homeimg.add(update);
update.addActionListener(this);

view = new JButton("View Employee");


view.setBounds(820, 150, 150, 40);
homeimg.add(view);
view.addActionListener(this);

setLayout(null);
setSize(1120,630);
setVisible(true);
setLocation(105,40);
}
public void actionPerformed( ActionEvent ae){
if(ae.getSource() == add){
setVisible(false);
new AddEmp();
}else if(ae.getSource() == remove){

}else if(ae.getSource() == update){

}else{

}
}
public static void main(String args[]){
new Home();
}
}

//in aove there are 4 buttons to recognize which button is clicked we have to use ae and
getSource() methode
//that will return the object of the button on which click event is happend

connect:
package employee.management.system;

import java.sql.*;

public class Conn {

Connection con ;
Statement s ;

Conn(){
try{
Class.forName("com.mysql.cj.jdbc.Driver");
con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/employeemanagementsystem" ,"root","dhananjay@963" );
s = con.createStatement();
}catch(Exception e){
e.printStackTrace();
}
}
public static void main(String args[]){
new Conn();
}
}
splash:
package employee.management.system;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Splash extends JFrame implements ActionListener {


Splash(){

getContentPane().setBackground(Color.WHITE); //Accesing the created frame


setLayout(null); // used to disable the defatult layouts and to create and use user layouts

JLabel heading = new JLabel("EMPLOYEE MANAGEMENT SYSTEM");


//component is created
heading.setBounds(200,30,1200,60); //(from left, form top, its size ie.heading size)
Font font = new Font("serif" , Font.BOLD , 50);
heading.setFont(font);
add(heading); //adding component to the frame.
heading.setForeground(Color.BLACK);

// Im below section image is grabed as imagicon and converted to image for scalling
purpouse and then
// scaledimge is converted into imageicon to add these image into the frame we have to
make object of jlael
// ie. add only accepts the jlabel object.
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/front.jpg"));
Image i2 = i1.getImage().getScaledInstance(1100,700,Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel image = new JLabel(i3);
image.setBounds(150, 130, 1050, 500); //image diemensions are set
add(image);

// button is created using jbutton class and then to display button relative to the position
of
// image we used image.add(button)
JButton click = new JButton("CLICK TO CONTINUE");
click.setBounds(400, 400, 250, 40);
image.add(click);
click.addActionListener(this);

setSize(1170,650);
setLocation(30,20);
setVisible(true);

}
public void actionPerformed(ActionEvent e){
setVisible(false);
new Login();
}
public static void main(String[] args){
new Splash();
}
}

//Actionlistner is interface in the java.awt.evet;


//It has only one methode actionPerformed(ActionEvent e);
// to listen event and do the required work
//1. implements ActionListener interface
//2. add evetn listner to the component ie [com.addActionListener(Instanceoflisterner class)]
//3. override the [actionPerformed(ActionEvent e)] methode with appropriate requirements
Testing document
Sr. Description Input Output Status
No.
1. Update personal details Add or replace Profile updated Pass
new details Successfully
2. Admin login Correct Login Successfully Pass
username and
password
3. Add employee New employee Employee added Pass
information successfully
4. Delete employee Pass
Delete Employee Employee data delete
data successfully
5. Add Aadhaar number Pass
12-digit number 12-digit number is added
should be added
6. Add mobile number Pass
10-digit number 10-digit number is added
should be added
7. Add email Id Pass
It should contain Email with @ symbol
@ symbol accepted
8. View employee Pass
After entering Employee data is shown
employee id
employee data
should be viewed

You might also like