Attendance System App Java Swing with MySQL Database
Output Screen
Splash File
Login Page
Register Page
Home Page
Add Student
Attendance Page
Student List
Teacher Profile
Search Studrnt By Name or Roll
Attendance Update
Splash.java
package com.deepsingh44.blogspot.ui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.io.File;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.border.EmptyBorder;
import com.deepsingh44.blogspot.utility.Util;
import javax.swing.JLabel;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import java.awt.Font;
import javax.swing.border.BevelBorder;
public class Splash extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
Splash frame = new Splash();
}
/**
* Create the frame.
*/
public Splash() {
Util.setLookAndFeel();
setUndecorated(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(400, 250);
setLocationRelativeTo(null);
contentPane = new JPanel();
setContentPane(contentPane);
JProgressBar pb = new JProgressBar();
pb.setBorder(new BevelBorder(BevelBorder.RAISED, null, null, null,
null));
pb.setBounds(0, 233, 400, 17);
pb.setStringPainted(true);
pb.setIndeterminate(true);
contentPane.setLayout(null);
contentPane.add(pb);
JLabel lblStudentAttendanceSystem = new JLabel("Student Attendance
System");
lblStudentAttendanceSystem.setForeground(new Color(255, 255, 255));
lblStudentAttendanceSystem.setFont(new Font("Serif", Font.BOLD,
20));
lblStudentAttendanceSystem.setBounds(72, 188, 252, 34);
contentPane.add(lblStudentAttendanceSystem);
ImageIcon im = new
ImageIcon(Splash.class.getResource("/com/deepsingh44/blogspot/images/group.jpg"));
JLabel lblNewLabel = new JLabel(Util.resize(im, 400, 239));
lblNewLabel.setBorder(new BevelBorder(BevelBorder.RAISED, null,
null, null, null));
lblNewLabel.setBounds(0, 0, 400, 239);
contentPane.add(lblNewLabel);
setVisible(true);
//just a dummy wait for progress...
for (int i = 0; i <= 100; i++) {
pb.setValue(i);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//After completion of progress bar open Login Page code here
if (pb.getValue() == 100) {
dispose();
Login login = new Login();
login.setVisible(true);
}
}
}
Login.java
package com.deepsingh44.blogspot.ui;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.border.EmptyBorder;
import com.deepsingh44.blogspot.dao.TeacherDao;
import com.deepsingh44.blogspot.model.Teacher;
import com.deepsingh44.blogspot.utility.Util;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JCheckBox;
import javax.swing.JButton;
import javax.swing.border.BevelBorder;
import javax.swing.ImageIcon;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;
import javax.swing.border.LineBorder;
public class Login extends JFrame {
private JPanel contentPane;
private JTextField tid;
private JPasswordField tpass;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Login frame = new Login();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Login() {
Util.setLookAndFeel();
// setUndecorated(true);
setTitle("Teacher Login Page");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 604, 456);
setLocationRelativeTo(null);
contentPane = new JPanel();
contentPane.setBackground(new Color(0, 102, 102));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBackground(new Color(255, 51, 0));
panel.setBorder(new BevelBorder(BevelBorder.RAISED, null, null,
null, null));
panel.setBounds(25, 52, 227, 336);
contentPane.add(panel);
panel.setLayout(null);
ImageIcon im = new
ImageIcon(Login.class.getResource("/com/deepsingh44/blogspot/images/college.jpg"));
JLabel label = new JLabel(Util.resize(im, 207, 169));
label.setBorder(new BevelBorder(BevelBorder.RAISED, null, null,
null, null));
label.setBounds(10, 11, 207, 169);
panel.add(label);
JLabel lblThisIsAn = new JLabel(
" With the App, teachers can mark attendance of
students in their class in no time, without any paperwork. ... Using the app, the teachers can actively
engage parents to participate more in their ward's scholastic activities, on a daily basis.
",
JLabel.CENTER);
lblThisIsAn.setFont(new Font("Serif", Font.PLAIN, 12));
lblThisIsAn.setForeground(new Color(255, 255, 255));
lblThisIsAn.setBorder(null);
lblThisIsAn.setVerticalAlignment(JLabel.TOP);
lblThisIsAn.setBounds(10, 191, 207, 134);
panel.add(lblThisIsAn);
JPanel panel_1 = new JPanel();
panel_1.setBackground(new Color(0.0f, 0.0f, 0.0f, 0.5f));
panel_1.setBorder(new BevelBorder(BevelBorder.RAISED, null,
null, null, null));
panel_1.setBounds(281, 52, 274, 336);
contentPane.add(panel_1);
panel_1.setLayout(null);
JLabel lblEnterTeacherId = new JLabel("Enter Teacher ID");
lblEnterTeacherId.setFont(new Font("Tahoma", Font.BOLD, 11));
lblEnterTeacherId.setForeground(Color.WHITE);
lblEnterTeacherId.setBounds(24, 80, 106, 14);
panel_1.add(lblEnterTeacherId);
tid = new JTextField();
tid.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null,
null, null));
tid.setBounds(24, 96, 220, 30);
panel_1.add(tid);
tid.setColumns(10);
tpass = new JPasswordField();
tpass.setBorder(new BevelBorder(BevelBorder.LOWERED, null,
null, null, null));
tpass.setColumns(10);
tpass.setBounds(24, 156, 220, 30);
panel_1.add(tpass);
JLabel lblEnterPassword = new JLabel("Enter Password");
lblEnterPassword.setFont(new Font("Tahoma", Font.BOLD, 11));
lblEnterPassword.setForeground(Color.WHITE);
lblEnterPassword.setBounds(24, 140, 106, 14);
panel_1.add(lblEnterPassword);
JCheckBox chckbxForgetPassword = new JCheckBox("Forget
Password");
chckbxForgetPassword.setBorder(new
BevelBorder(BevelBorder.RAISED, null, null, null, null));
/*
* chckbxForgetPassword.setBackground(new Color(0.0f, 0.0f,
0.0f,
* 0.5f));
*/
chckbxForgetPassword.setForeground(new Color(255, 255, 255));
chckbxForgetPassword.setBounds(115, 197, 129, 23);
panel_1.add(chckbxForgetPassword);
JButton btnLoginHere = new JButton("Singin");
btnLoginHere.setBorder(new BevelBorder(BevelBorder.RAISED,
null, null, null, null));
btnLoginHere.setForeground(Color.WHITE);
btnLoginHere.setBackground(Color.BLUE);
btnLoginHere.setBounds(10, 278, 119, 30);
panel_1.add(btnLoginHere);
JLabel lblLoginDetails = new JLabel("Login
Details");
lblLoginDetails.setForeground(new Color(255, 255, 255));
lblLoginDetails.setFont(new Font("Tahoma", Font.BOLD, 12));
lblLoginDetails.setBounds(89, 24, 92, 14);
panel_1.add(lblLoginDetails);
JButton btnSignup = new JButton("Signup");
btnSignup.setForeground(Color.WHITE);
btnSignup.setBorder(new BevelBorder(BevelBorder.RAISED, null,
null, null, null));
btnSignup.setBackground(new Color(0, 153, 51));
btnSignup.setBounds(145, 278, 119, 30);
panel_1.add(btnSignup);
ImageIcon ic = new
ImageIcon(Login.class.getResource("/com/deepsingh44/blogspot/images/group.jpg"));
JLabel lblNewLabel = new JLabel(Util.resize(ic, 604, 456));
lblNewLabel.setBounds(0, 0, 604, 456);
contentPane.add(lblNewLabel);
// add event here
// login button click code
btnLoginHere.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// get value from field first
if (valid()) {
// after validation check teacher is valid or not from
// database
TeacherDao td=TeacherDao.geTeacherDao();
Teacher teacher=td.login(Integer.parseInt(id), pass);
if(teacher!=null){
Util.showMessage(Login.this, "Successfully login");
HomePage hp=new HomePage(teacher);
hp.setVisible(true);
dispose();
}else{
Util.showError(Login.this, "Login failed");
}
}
}
});
btnSignup.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Register register = new Register();
register.setVisible(true);
dispose();
}
});
}
private String id, pass;
private boolean valid() {
id = tid.getText();
pass = String.valueOf(tpass.getPassword());
if (id.isEmpty()) {
Util.showWarning(this, "please enter id");
tid.requestFocus();
return false;
} else if (pass.isEmpty()) {
Util.showWarning(this, "please enter password");
tpass.requestFocus();
return false;
} else {
return true;
}
}
}
Register.java
package com.deepsingh44.blogspot.ui;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import com.deepsingh44.blogspot.dao.TeacherDao;
import com.deepsingh44.blogspot.model.Teacher;
import com.deepsingh44.blogspot.utility.Util;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JTextField;
import javax.swing.border.BevelBorder;
import javax.swing.JPasswordField;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Register extends JFrame {
private JPanel contentPane;
private JTextField tid;
private JPasswordField tpass;
private JTextField tname;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Register frame = new Register();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Register() {
setTitle("Teacher Register Page");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 604, 456);
setLocationRelativeTo(null);
contentPane = new JPanel();
contentPane.setBackground(new Color(0, 102, 102));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBorder(new BevelBorder(BevelBorder.RAISED, null, null,
null, null));
panel.setBackground(new Color(255, 204, 0));
panel.setBounds(10, 59, 234, 324);
contentPane.add(panel);
panel.setLayout(null);
ImageIcon im = new
ImageIcon(Login.class.getResource("/com/deepsingh44/blogspot/images/college.jpg"));
JLabel label = new JLabel(Util.resize(im, 207, 169));
label.setBorder(new BevelBorder(BevelBorder.RAISED, null, null,
null, null));
label.setBounds(10, 11, 214, 169);
panel.add(label);
JLabel lblThisIsAn = new JLabel(
" With the App, teachers can mark attendance of
students in their class in no time, without any paperwork. ... Using the app, the teachers can actively
engage parents to participate more in their ward's scholastic activities, on a daily basis.
",
JLabel.CENTER);
lblThisIsAn.setFont(new Font("Serif", Font.PLAIN, 12));
lblThisIsAn.setForeground(new Color(255, 255, 255));
lblThisIsAn.setBorder(null);
lblThisIsAn.setVerticalAlignment(JLabel.TOP);
lblThisIsAn.setBounds(10, 191, 214, 134);
panel.add(lblThisIsAn);
JPanel panel_1 = new JPanel();
panel_1.setBorder(new BevelBorder(BevelBorder.RAISED, null,
null, null, null));
panel_1.setBackground(new Color(0.0f, 0.0f, 0.0f, 0.5f));
panel_1.setBounds(265, 59, 313, 324);
contentPane.add(panel_1);
panel_1.setLayout(null);
JLabel lblLoginDetails = new
JLabel("Register Details");
lblLoginDetails.setForeground(Color.WHITE);
lblLoginDetails.setFont(new Font("Tahoma", Font.BOLD, 12));
lblLoginDetails.setBounds(101, 30, 125, 14);
panel_1.add(lblLoginDetails);
JLabel lblEnterTeacherId = new JLabel("Enter Teacher ID");
lblEnterTeacherId.setForeground(Color.WHITE);
lblEnterTeacherId.setFont(new Font("Tahoma", Font.BOLD, 11));
lblEnterTeacherId.setBounds(47, 85, 106, 14);
panel_1.add(lblEnterTeacherId);
tid = new JTextField();
tid.setColumns(10);
tid.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null,
null, null));
tid.setBounds(47, 101, 220, 30);
panel_1.add(tid);
JLabel lblEnterPassword = new JLabel("Enter Password");
lblEnterPassword.setForeground(Color.WHITE);
lblEnterPassword.setFont(new Font("Tahoma", Font.BOLD, 11));
lblEnterPassword.setBounds(47, 145, 106, 14);
panel_1.add(lblEnterPassword);
tpass = new JPasswordField();
tpass.setColumns(10);
tpass.setBorder(new BevelBorder(BevelBorder.LOWERED, null,
null, null, null));
tpass.setBounds(47, 161, 220, 30);
panel_1.add(tpass);
JButton signup = new JButton("Singup");
signup.setForeground(Color.WHITE);
signup.setBorder(new BevelBorder(BevelBorder.RAISED, null,
null, null, null));
signup.setBackground(Color.BLUE);
signup.setBounds(33, 283, 119, 30);
panel_1.add(signup);
JButton signin = new JButton("Signin");
signin.setForeground(Color.WHITE);
signin.setBorder(new BevelBorder(BevelBorder.RAISED, null,
null, null, null));
signin.setBackground(new Color(0, 153, 51));
signin.setBounds(168, 283, 119, 30);
panel_1.add(signin);
JLabel lblEnterName = new JLabel("Enter Name");
lblEnterName.setForeground(Color.WHITE);
lblEnterName.setFont(new Font("Tahoma", Font.BOLD, 11));
lblEnterName.setBounds(47, 209, 106, 14);
panel_1.add(lblEnterName);
tname = new JTextField();
tname.setColumns(10);
tname.setBorder(new BevelBorder(BevelBorder.LOWERED, null,
null, null, null));
tname.setBounds(47, 225, 220, 30);
panel_1.add(tname);
ImageIcon im1 = new
ImageIcon(Login.class.getResource("/com/deepsingh44/blogspot/images/group.jpg"));
JLabel lblNewLabel = new JLabel(Util.resize(im1, 588, 417));
lblNewLabel.setBackground(new Color(0, 153, 102));
lblNewLabel.setBounds(0, 0, 588, 417);
contentPane.add(lblNewLabel);
// add event here
signin.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Login login = new Login();
login.setVisible(true);
dispose();
}
});
signup.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (valid()) {
// after validation we want to store data into database.
// Step 1: create connection
// Step 2:create database
// Step 3:create table
// compose all data into model class
Teacher teacher = new Teacher();
teacher.setId(Integer.parseInt(id));
teacher.setName(name);
teacher.setPassword(pass);
teacher.setImage("");
teacher.setTechnology("");
// send this model class object to database layer
TeacherDao teacherDao = TeacherDao.geTeacherDao();
int i = teacherDao.insert(teacher);
if (i > 0) {
Util.showMessage(Register.this, "Successfully Register");
clear();
} else {
Util.showMessage(Register.this, "Registered Failed");
}
}
}
});
}
private void clear(){
tid.setText("");
tpass.setText("");
tname.setText("");
}
private String id, name, pass;
private boolean valid() {
// get data from textfield one
id = tid.getText();
// get data from passwordfield two
pass = String.valueOf(tpass.getPassword());
// get data from textfield third
name = tname.getText();
if (id.isEmpty()) {
Util.showWarning(this, "please enter teacher id");
tid.requestFocus();
return false;
} else if (pass.isEmpty()) {
Util.showWarning(this, "please enter teacher password");
tpass.requestFocus();
return false;
} else if (name.isEmpty()) {
Util.showWarning(this, "please enter teacher name");
tname.requestFocus();
return false;
} else {
return true;
}
}
}
15 comments:
👍
Jai ho gurudev
Yes deep sir please send for full code
Sir i need full code if you have a github repository link please share with me
Thank You
greate
Sir,I want full code please send me on this mail- mithileshprajapati4598@gmail.com
we are providing mobile online attendance application services. for more information plz visit us. mobile attendance app provider in delhi Mobile attendance system
pls send full code
Attendance Management App
We are provide Biometric Attendance Machine and support. For More info please visit :
attendance machine
Biometric Machine
biometric attendance machine in gurgaon
Nice post & love to hear more from you!
biometric attendance system dealers Hyderabad
Learn about the top 5 apps for 2023 that give geo-attendance and in-depth statistics to track staff attendance.KYTE provides geo-location monitoring features in addition to automated geo-attendance for when employees clock in and depart, a historical record of on-site personnel, and the capability for management to construct a geo-fence to monitor employee presence in a specific area throughout working hours.
mobile based daily attendance app
Great job on creating the Attendance System App using Java Swing and MySQL Database! Your detailed explanation of the code's structure and functionality showcases your strong programming skills. The commitment to enhancing transparency and efficiency resonates well with Flowace Attendance Tracker's objectives. The user-friendly features, including the login and registration processes, demonstrate a dedication to seamless attendance management. Your work aligns perfectly with Flowace's principles. Keep up the excellent work!
Post a Comment