0% found this document useful (0 votes)
35 views100 pages

University Management Codes

The document contains Java code for a university management system with multiple classes, including 'About', 'AddTeacher', 'Conn', and 'EnterMarks'. Each class is responsible for different functionalities such as displaying information about the system, adding teacher details, establishing a database connection, and entering student marks. The code utilizes Swing for the GUI and MySQL for database interactions.

Uploaded by

AvDesh Vats
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views100 pages

University Management Codes

The document contains Java code for a university management system with multiple classes, including 'About', 'AddTeacher', 'Conn', and 'EnterMarks'. Each class is responsible for different functionalities such as displaying information about the system, adding teacher details, establishing a database connection, and entering student marks. The code utilizes Swing for the GUI and MySQL for database interactions.

Uploaded by

AvDesh Vats
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 100

ABOUT

package university.management.system;

import javax.swing.*;

import java.awt.*;

public

class About extends JFrame

About()

setSize(700, 500);

setLocation(400, 150);

getContentPane().setBackground(Color.WHITE);

ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/about.jpg"));

Image i2 = i1.getImage().getScaledInstance(300, 200, Image.SCALE_DEFAULT);

ImageIcon i3 = new ImageIcon(i2);

JLabel image = new JLabel(i3);

image.setBounds(350, 0, 300, 200);

add(image);

JLabel heading = new JLabel("<html>University<br/>Management System</html>");

heading.setBounds(70, 20, 300, 130);

heading.setFont(new Font("Tahoma", Font.BOLD, 30));

add(heading);

JLabel name = new JLabel("Developed By: Code for Interview");


name.setBounds(70, 220, 550, 40);

name.setFont(new Font("Tahoma", Font.BOLD, 30));

add(name);

JLabel rollno = new JLabel("Roll number: 1533146");

rollno.setBounds(70, 280, 550, 40);

rollno.setFont(new Font("Tahoma", Font.PLAIN, 30));

add(rollno);

JLabel contact = new JLabel("Contact: [email protected]");

contact.setBounds(70, 340, 550, 40);

contact.setFont(new Font("Tahoma", Font.PLAIN, 20));

add(contact);

setLayout(null);

setVisible(true);

public

static void main(String[] args)

new About();

} package university.management.system;

import javax.swing.*;

import java.awt.*;

public
class About extends JFrame

About()

setSize(700, 500);

setLocation(400, 150);

getContentPane().setBackground(Color.WHITE);

ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/about.jpg"));

Image i2 = i1.getImage().getScaledInstance(300, 200, Image.SCALE_DEFAULT);

ImageIcon i3 = new ImageIcon(i2);

JLabel image = new JLabel(i3);

image.setBounds(350, 0, 300, 200);

add(image);

JLabel heading = new JLabel("<html>University<br/>Management System</html>");

heading.setBounds(70, 20, 300, 130);

heading.setFont(new Font("Tahoma", Font.BOLD, 30));

add(heading);

JLabel name = new JLabel("Developed By: Code for Interview");

name.setBounds(70, 220, 550, 40);

name.setFont(new Font("Tahoma", Font.BOLD, 30));

add(name);

JLabel rollno = new JLabel("Roll number: 1533146");

rollno.setBounds(70, 280, 550, 40);

rollno.setFont(new Font("Tahoma", Font.PLAIN, 30));


add(rollno);

JLabel contact = new JLabel("Contact: [email protected]");

contact.setBounds(70, 340, 550, 40);

contact.setFont(new Font("Tahoma", Font.PLAIN, 20));

add(contact);

setLayout(null);

setVisible(true);

public

static void main(String[] args)

new About();

ADD TEACHER

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.util.*;

import com.toedter.calendar.JDateChooser;

import java.awt.event.*;

public
class AddTeacher extends JFrame implements ActionListener

JTextField tfname, tffname, tfaddress, tfphone, tfemail, tfx, tfxii, tfaadhar;

JLabel labelempId;

JDateChooser dcdob;

JComboBox cbcourse, cbbranch;

JButton submit, cancel;

Random ran = new Random();

long first4 = Math.abs((ran.nextLong() % 9000L) + 1000L);

AddTeacher()

setSize(900, 700);

setLocation(350, 50);

setLayout(null);

JLabel heading = new JLabel("New Teacher Details");

heading.setBounds(310, 30, 500, 50);

heading.setFont(new Font("serif", Font.BOLD, 30));

add(heading);

JLabel lblname = new JLabel("Name");

lblname.setBounds(50, 150, 100, 30);

lblname.setFont(new Font("serif", Font.BOLD, 20));

add(lblname);
tfname = new JTextField();

tfname.setBounds(200, 150, 150, 30);

add(tfname);

JLabel lblfname = new JLabel("Father's Name");

lblfname.setBounds(400, 150, 200, 30);

lblfname.setFont(new Font("serif", Font.BOLD, 20));

add(lblfname);

tffname = new JTextField();

tffname.setBounds(600, 150, 150, 30);

add(tffname);

JLabel lblempId = new JLabel("Employee Id");

lblempId.setBounds(50, 200, 200, 30);

lblempId.setFont(new Font("serif", Font.BOLD, 20));

add(lblempId);

labelempId = new JLabel("101" + first4);

labelempId.setBounds(200, 200, 200, 30);

labelempId.setFont(new Font("serif", Font.BOLD, 20));

add(labelempId);

JLabel lbldob = new JLabel("Date of Birth");

lbldob.setBounds(400, 200, 200, 30);

lbldob.setFont(new Font("serif", Font.BOLD, 20));

add(lbldob);

dcdob = new JDateChooser();


dcdob.setBounds(600, 200, 150, 30);

add(dcdob);

JLabel lbladdress = new JLabel("Address");

lbladdress.setBounds(50, 250, 200, 30);

lbladdress.setFont(new Font("serif", Font.BOLD, 20));

add(lbladdress);

tfaddress = new JTextField();

tfaddress.setBounds(200, 250, 150, 30);

add(tfaddress);

JLabel lblphone = new JLabel("Phone");

lblphone.setBounds(400, 250, 200, 30);

lblphone.setFont(new Font("serif", Font.BOLD, 20));

add(lblphone);

tfphone = new JTextField();

tfphone.setBounds(600, 250, 150, 30);

add(tfphone);

JLabel lblemail = new JLabel("Email Id");

lblemail.setBounds(50, 300, 200, 30);

lblemail.setFont(new Font("serif", Font.BOLD, 20));

add(lblemail);

tfemail = new JTextField();

tfemail.setBounds(200, 300, 150, 30);

add(tfemail);
JLabel lblx = new JLabel("Class X (%)");

lblx.setBounds(400, 300, 200, 30);

lblx.setFont(new Font("serif", Font.BOLD, 20));

add(lblx);

tfx = new JTextField();

tfx.setBounds(600, 300, 150, 30);

add(tfx);

JLabel lblxii = new JLabel("Class XII (%)");

lblxii.setBounds(50, 350, 200, 30);

lblxii.setFont(new Font("serif", Font.BOLD, 20));

add(lblxii);

tfxii = new JTextField();

tfxii.setBounds(200, 350, 150, 30);

add(tfxii);

JLabel lblaadhar = new JLabel("Aadhar Number");

lblaadhar.setBounds(400, 350, 200, 30);

lblaadhar.setFont(new Font("serif", Font.BOLD, 20));

add(lblaadhar);

tfaadhar = new JTextField();

tfaadhar.setBounds(600, 350, 150, 30);

add(tfaadhar);

JLabel lblcourse = new JLabel("Qualification");


lblcourse.setBounds(50, 400, 200, 30);

lblcourse.setFont(new Font("serif", Font.BOLD, 20));

add(lblcourse);

String course[] = {"B.Tech", "BBA", "BCA", "Bsc", "Msc", "MBA", "MCA", "MCom", "MA", "BA"};

cbcourse = new JComboBox(course);

cbcourse.setBounds(200, 400, 150, 30);

cbcourse.setBackground(Color.WHITE);

add(cbcourse);

JLabel lblbranch = new JLabel("Department");

lblbranch.setBounds(400, 400, 200, 30);

lblbranch.setFont(new Font("serif", Font.BOLD, 20));

add(lblbranch);

String branch[] = {"Computer Science", "Electronics", "Mechanical", "Civil", "IT"};

cbbranch = new JComboBox(branch);

cbbranch.setBounds(600, 400, 150, 30);

cbbranch.setBackground(Color.WHITE);

add(cbbranch);

submit = new JButton("Submit");

submit.setBounds(250, 550, 120, 30);

submit.setBackground(Color.BLACK);

submit.setForeground(Color.WHITE);

submit.addActionListener(this);

submit.setFont(new Font("Tahoma", Font.BOLD, 15));

add(submit);
cancel = new JButton("Cancel");

cancel.setBounds(450, 550, 120, 30);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);

cancel.addActionListener(this);

cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == submit)

String name = tfname.getText();

String fname = tffname.getText();

String rollno = labelempId.getText();

String dob = ((JTextField)dcdob.getDateEditor().getUiComponent()).getText();

String address = tfaddress.getText();

String phone = tfphone.getText();

String email = tfemail.getText();

String x = tfx.getText();

String xii = tfxii.getText();

String aadhar = tfaadhar.getText();

String course = (String)cbcourse.getSelectedItem();

String branch = (String)cbbranch.getSelectedItem();

try
{

String query = "insert into teacher values('"+name+"', '"+fname+"', '"+rollno+"', '"+dob+"',

'"+address+"', '"+phone+"', '"+email+"', '"+x+"', '"+xii+"', '"+aadhar+"', '"+course+"', '"+branch+"')";

Conn con = new Conn();

con.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "Teacher Details Inserted Successfully");

setVisible(false);

catch (Exception e)

e.printStackTrace();

else

setVisible(false);

public

static void main(String[] args)

new AddTeacher();

}
CONNECTION

package university.management.system;

import java.sql.*;

public

class Conn

Connection c;

Statement s;

Conn()

try

Class.forName("com.mysql.cj.jdbc.Driver");

c = DriverManager.getConnection("jdbc:mysql:///universitymanagementsystem", "root",

"codeforinterview");

s = c.createStatement();

catch (Exception e)

e.printStackTrace();

}
ENTER MARKS

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import java.awt.event.*;

public

class EnterMarks extends JFrame implements ActionListener

Choice crollno;

JComboBox cbsemester;

JTextField tfsub1, tfsub2, tfsub3, tfsub4, tfsub5, tfmarks1, tfmarks2, tfmarks3, tfmarks4, tfmarks5;

JButton cancel, submit;

EnterMarks()

setSize(1000, 500);

setLocation(300, 150);

setLayout(null);

getContentPane().setBackground(Color.WHITE);

ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/exam.jpg"));

Image i2 = i1.getImage().getScaledInstance(400, 300, Image.SCALE_DEFAULT);


ImageIcon i3 = new ImageIcon(i2);

JLabel image = new JLabel(i3);

image.setBounds(500, 40, 400, 300);

add(image);

JLabel heading = new JLabel("Enter Marks of Student");

heading.setBounds(50, 0, 500, 50);

heading.setFont(new Font("Tahoma", Font.BOLD, 20));

add(heading);

JLabel lblrollnumber = new JLabel("Select Roll Number");

lblrollnumber.setBounds(50, 70, 150, 20);

add(lblrollnumber);

crollno = new Choice();

crollno.setBounds(200, 70, 150, 20);

add(crollno);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from student");

while (rs.next())

crollno.add(rs.getString("rollno"));

catch (Exception e)

{
e.printStackTrace();

JLabel lblsemester = new JLabel("Select Semester");

lblsemester.setBounds(50, 110, 150, 20);

add(lblsemester);

String semester[] = {"1st Semester", "2nd Semester", "3rd Semester", "4th Semester", "5th
Semester", "6th Semester", "7th Semester", "8th Semester"};

cbsemester = new JComboBox(semester);

cbsemester.setBounds(200, 110, 150, 20);

cbsemester.setBackground(Color.WHITE);

add(cbsemester);

JLabel lblentersubject = new JLabel("Enter Subject");

lblentersubject.setBounds(100, 150, 200, 40);

add(lblentersubject);

JLabel lblentermarks = new JLabel("Enter Marks");

lblentermarks.setBounds(320, 150, 200, 40);

add(lblentermarks);

tfsub1 = new JTextField();

tfsub1.setBounds(50, 200, 200, 20);

add(tfsub1);

tfsub2 = new JTextField();

tfsub2.setBounds(50, 230, 200, 20);

add(tfsub2);
tfsub3 = new JTextField();

tfsub3.setBounds(50, 260, 200, 20);

add(tfsub3);

tfsub4 = new JTextField();

tfsub4.setBounds(50, 290, 200, 20);

add(tfsub4);

tfsub5 = new JTextField();

tfsub5.setBounds(50, 320, 200, 20);

add(tfsub5);

tfmarks1 = new JTextField();

tfmarks1.setBounds(250, 200, 200, 20);

add(tfmarks1);

tfmarks2 = new JTextField();

tfmarks2.setBounds(250, 230, 200, 20);

add(tfmarks2);

tfmarks3 = new JTextField();

tfmarks3.setBounds(250, 260, 200, 20);

add(tfmarks3);

tfmarks4 = new JTextField();

tfmarks4.setBounds(250, 290, 200, 20);

add(tfmarks4);
tfmarks5 = new JTextField();

tfmarks5.setBounds(250, 320, 200, 20);

add(tfmarks5);

submit = new JButton("Submit");

submit.setBounds(70, 360, 150, 25);

submit.setBackground(Color.BLACK);

submit.setForeground(Color.WHITE);

submit.addActionListener(this);

submit.setFont(new Font("Tahoma", Font.BOLD, 15));

add(submit);

cancel = new JButton("Back");

cancel.setBounds(280, 360, 150, 25);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);

cancel.addActionListener(this);

cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == submit)

try
{

Conn c = new Conn();

String query1 = "insert into subject values('"+crollno.getSelectedItem()+"',

'"+cbsemester.getSelectedItem()+"', '"+tfsub1.getText()+"', '"+tfsub2.getText()+"', '"+tfsub3.getText()+"',


'"+tfsub4.getText()+"', '"+tfsub5.getText()+"')";

String query2 = "insert into marks values('"+crollno.getSelectedItem()+"',

'"+cbsemester.getSelectedItem()+"', '"+tfmarks1.getText()+"', '"+tfmarks2.getText()+"',

'"+tfmarks3.getText()+"', '"+tfmarks4.getText()+"', '"+tfmarks5.getText()+"')";

c.s.executeUpdate(query1);

c.s.executeUpdate(query2);

JOptionPane.showMessageDialog(null, "Marks Inserted Sucessfully");

setVisible(false);

catch (Exception e)

e.printStackTrace();

else

setVisible(false);

public

static void main(String[] args)


{

new EnterMarks();

EXAMINATION DETAILS

package university.management.system;

import java.awt.*;

import javax.swing.*;

import java.sql.*;

import net.proteanit.sql.DbUtils;

import java.awt.event.*;

public

class ExaminationDetails extends JFrame implements ActionListener

JTextField search;

JButton submit, cancel;

JTable table;

ExaminationDetails()
{

setSize(1000, 475);

setLocation(300, 100);

setLayout(null);

getContentPane().setBackground(Color.WHITE);

JLabel heading = new JLabel("Check Result");

heading.setBounds(80, 15, 400, 50);

heading.setFont(new Font("Tahoma", Font.BOLD, 24));

add(heading);

search = new JTextField();

search.setBounds(80, 90, 200, 30);

search.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(search);

submit = new JButton("Result");

submit.setBounds(300, 90, 120, 30);

submit.setBackground(Color.BLACK);

submit.setForeground(Color.WHITE);

submit.addActionListener(this);

submit.setFont(new Font("Tahoma", Font.BOLD, 15));

add(submit);

cancel = new JButton("Back");

cancel.setBounds(440, 90, 120, 30);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);
cancel.addActionListener(this);

cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

table = new JTable();

table.setFont(new Font("Tahoma", Font.PLAIN, 16));

JScrollPane jsp = new JScrollPane(table);

jsp.setBounds(0, 130, 1000, 310);

add(jsp);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from student");

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

e.printStackTrace();

table.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent me) {


int row = table.getSelectedRow(); search.setText(table.getModel().getValueAt(row,
2).toString());

});

setVisible(true);

}
public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == submit)

setVisible(false);

new Marks(search.getText());

else

setVisible(false);

public

static void main(String[] args)

new ExaminationDetails();

}
FEE STRUCTURE

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import net.proteanit.sql.DbUtils;

public

class FeeStructure extends JFrame

FeeStructure()

setSize(1000, 700);

setLocation(250, 50);

setLayout(null);

getContentPane().setBackground(Color.WHITE);

JLabel heading = new JLabel("Fee Structure");

heading.setBounds(50, 10, 400, 30);

heading.setFont(new Font("Tahoma", Font.BOLD, 30));

add(heading);

JTable table = new JTable();

try

{
Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from fee");

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

e.printStackTrace();

JScrollPane jsp = new JScrollPane(table);

jsp.setBounds(0, 60, 1000, 700);

add(jsp);

setVisible(true);

public

static void main(String[] args)

new FeeStructure();

}
LOGIN

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public

class Login extends JFrame implements ActionListener

JButton login, cancel;

JTextField tfusername, tfpassword;

Login()

getContentPane().setBackground(Color.WHITE);

setLayout(null);

JLabel lblusername = new JLabel("Username");

lblusername.setBounds(40, 20, 100, 20);

add(lblusername);

tfusername = new JTextField();

tfusername.setBounds(150, 20, 150, 20);

add(tfusername);
JLabel lblpassword = new JLabel("Password");

lblpassword.setBounds(40, 70, 100, 20);

add(lblpassword);

tfpassword = new JPasswordField();

tfpassword.setBounds(150, 70, 150, 20);

add(tfpassword);

login = new JButton("Login");

login.setBounds(40, 140, 120, 30);

login.setBackground(Color.BLACK);

login.setForeground(Color.WHITE);

login.addActionListener(this);

login.setFont(new Font("Tahoma", Font.BOLD, 15));

add(login);

cancel = new JButton("Cancel");

cancel.setBounds(180, 140, 120, 30);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);

cancel.addActionListener(this);

cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/second.jpg"));

Image i2 = i1.getImage().getScaledInstance(200, 200, Image.SCALE_DEFAULT);

ImageIcon i3 = new ImageIcon(i2);

JLabel image = new JLabel(i3);


image.setBounds(350, 0, 200, 200);

add(image);

setSize(600, 300);

setLocation(500, 250);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == login)

String username = tfusername.getText();

String password = tfpassword.getText();

String query = "select * from login where username='" + username + "' and password='" +
password + "'";

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery(query);

if (rs.next())

setVisible(false);

new Project();

else
{

JOptionPane.showMessageDialog(null, "Invalid username or password");

setVisible(false);

catch (Exception e)

e.printStackTrace();

else if (ae.getSource() == cancel)

setVisible(false);

public

static void main(String[] args)

new Login();

}
MARKS

package university.management.system;

import java.awt.*;

import javax.swing.*;

import java.sql.*;

import java.awt.event.*;

public

class Marks extends JFrame implements ActionListener

String rollno;

JButton cancel;

Marks(String rollno)

this.rollno = rollno;

setSize(500, 600);

setLocation(500, 100);

setLayout(null);

getContentPane().setBackground(Color.WHITE);

JLabel heading = new JLabel("Delhi Technical Univeristy");

heading.setBounds(100, 10, 500, 25);

heading.setFont(new Font("Tahoma", Font.BOLD, 20));


add(heading);

JLabel subheading = new JLabel("Result of Examination 2022");

subheading.setBounds(100, 50, 500, 20);

subheading.setFont(new Font("Tahoma", Font.BOLD, 18));

add(subheading);

JLabel lblrollno = new JLabel("Roll Number " + rollno);

lblrollno.setBounds(60, 100, 500, 20);

lblrollno.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(lblrollno);

JLabel lblsemester = new JLabel();

lblsemester.setBounds(60, 130, 500, 20);

lblsemester.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(lblsemester);

JLabel sub1 = new JLabel();

sub1.setBounds(100, 200, 500, 20);

sub1.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(sub1);

JLabel sub2 = new JLabel();

sub2.setBounds(100, 230, 500, 20);

sub2.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(sub2);

JLabel sub3 = new JLabel();

sub3.setBounds(100, 260, 500, 20);


sub3.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(sub3);

JLabel sub4 = new JLabel();

sub4.setBounds(100, 290, 500, 20);

sub4.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(sub4);

JLabel sub5 = new JLabel();

sub5.setBounds(100, 320, 500, 20);

sub5.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(sub5);

try

Conn c = new Conn();

ResultSet rs1 = c.s.executeQuery("select * from subject where rollno = '" + rollno + "'");

while (rs1.next())

sub1.setText(rs1.getString("subject1"));

sub2.setText(rs1.getString("subject2"));

sub3.setText(rs1.getString("subject3"));

sub4.setText(rs1.getString("subject4"));

sub5.setText(rs1.getString("subject5"));

ResultSet rs2 = c.s.executeQuery("select * from marks where rollno = '" + rollno + "'");

while (rs2.next())
{

sub1.setText(sub1.getText() + "------------" + rs2.getString("marks1"));

sub2.setText(sub2.getText() + "------------" + rs2.getString("marks2"));

sub3.setText(sub3.getText() + "------------" + rs2.getString("marks3"));

sub4.setText(sub4.getText() + "------------" + rs2.getString("marks4"));

sub5.setText(sub5.getText() + "------------" + rs2.getString("marks5"));

lblsemester.setText("Semester " + rs2.getString("semester"));

catch (Exception e)

e.printStackTrace();

cancel = new JButton("Back");

cancel.setBounds(250, 500, 120, 25);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);

cancel.addActionListener(this);

cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

setVisible(false);
}

public

static void main(String[] args)

new Marks("");

PROJECT

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public

class Project extends JFrame implements ActionListener

Project()

setSize(1540, 850);
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/third.jpg"));

Image i2 = i1.getImage().getScaledInstance(1500, 750, Image.SCALE_DEFAULT);

ImageIcon i3 = new ImageIcon(i2);

JLabel image = new JLabel(i3);

add(image);

JMenuBar mb = new JMenuBar();

// New Information

JMenu newInformation = new JMenu("New Information");

newInformation.setForeground(Color.BLUE);

mb.add(newInformation);

JMenuItem facultyInfo = new JMenuItem("New Faculty Information");

facultyInfo.setBackground(Color.WHITE);

facultyInfo.addActionListener(this);

newInformation.add(facultyInfo);

JMenuItem studentInfo = new JMenuItem("New Student Information");

studentInfo.setBackground(Color.WHITE);

studentInfo.addActionListener(this);

newInformation.add(studentInfo);

// Details

JMenu details = new JMenu("View Details");

details.setForeground(Color.RED);

mb.add(details);
JMenuItem facultydetails = new JMenuItem("View Faculty Details");

facultydetails.setBackground(Color.WHITE);

facultydetails.addActionListener(this);

details.add(facultydetails);

JMenuItem studentdetails = new JMenuItem("View Student Details");

studentdetails.setBackground(Color.WHITE);

studentdetails.addActionListener(this);

details.add(studentdetails);

// Leave

JMenu leave = new JMenu("Apply Leave");

leave.setForeground(Color.BLUE);

mb.add(leave);

JMenuItem facultyleave = new JMenuItem("Faculty Leave");

facultyleave.setBackground(Color.WHITE);

facultyleave.addActionListener(this);

leave.add(facultyleave);

JMenuItem studentleave = new JMenuItem("Student Leave");

studentleave.setBackground(Color.WHITE);

studentleave.addActionListener(this);

leave.add(studentleave);

// Leave Details

JMenu leaveDetails = new JMenu("Leave Details");

leaveDetails.setForeground(Color.RED);

mb.add(leaveDetails);
JMenuItem facultyleavedetails = new JMenuItem("Faculty Leave Details");

facultyleavedetails.setBackground(Color.WHITE);

facultyleavedetails.addActionListener(this);

leaveDetails.add(facultyleavedetails);

JMenuItem studentleavedetails = new JMenuItem("Student Leave Details");

studentleavedetails.setBackground(Color.WHITE);

studentleavedetails.addActionListener(this);

leaveDetails.add(studentleavedetails);

// Exams

JMenu exam = new JMenu("Examination");

exam.setForeground(Color.BLUE);

mb.add(exam);

JMenuItem examinationdetails = new JMenuItem("Examination Results");

examinationdetails.setBackground(Color.WHITE);

examinationdetails.addActionListener(this);

exam.add(examinationdetails);

JMenuItem entermarks = new JMenuItem("Enter Marks");

entermarks.setBackground(Color.WHITE);

entermarks.addActionListener(this);

exam.add(entermarks);

// UpdateInfo

JMenu updateInfo = new JMenu("Update Details");

updateInfo.setForeground(Color.RED);
mb.add(updateInfo);

JMenuItem updatefacultyinfo = new JMenuItem("Update Faculty Details");

updatefacultyinfo.setBackground(Color.WHITE);

updatefacultyinfo.addActionListener(this);

updateInfo.add(updatefacultyinfo);

JMenuItem updatestudentinfo = new JMenuItem("Update Student Details");

updatestudentinfo.setBackground(Color.WHITE);

updatestudentinfo.addActionListener(this);

updateInfo.add(updatestudentinfo);

// fee

JMenu fee = new JMenu("Fee Details");

fee.setForeground(Color.BLUE);

mb.add(fee);

JMenuItem feestructure = new JMenuItem("Fee Structure");

feestructure.setBackground(Color.WHITE);

feestructure.addActionListener(this);

fee.add(feestructure);

JMenuItem feeform = new JMenuItem("Student Fee Form");

feeform.setBackground(Color.WHITE);

feeform.addActionListener(this);

fee.add(feeform);

// Utility

JMenu utility = new JMenu("Utility");


utility.setForeground(Color.RED);

mb.add(utility);

JMenuItem notepad = new JMenuItem("Notepad");

notepad.setBackground(Color.WHITE);

notepad.addActionListener(this);

utility.add(notepad);

JMenuItem calc = new JMenuItem("Calculator");

calc.setBackground(Color.WHITE);

calc.addActionListener(this);

utility.add(calc);

// about

JMenu about = new JMenu("About");

about.setForeground(Color.BLUE);

mb.add(about);

JMenuItem ab = new JMenuItem("About");

ab.setBackground(Color.WHITE);

ab.addActionListener(this);

about.add(ab);

// exit

JMenu exit = new JMenu("Exit");

exit.setForeground(Color.RED);

mb.add(exit);

JMenuItem ex = new JMenuItem("Exit");


ex.setBackground(Color.WHITE);

ex.addActionListener(this);

exit.add(ex);

setJMenuBar(mb);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

String msg = ae.getActionCommand();

if (msg.equals("Exit"))

setVisible(false);

else if (msg.equals("Calculator"))

try

Runtime.getRuntime().exec("calc.exe");

catch (Exception e)

else if (msg.equals("Notepad"))
{

try

Runtime.getRuntime().exec("notepad.exe");

catch (Exception e)

else if (msg.equals("New Faculty Information"))

new AddTeacher();

else if (msg.equals("New Student Information"))

new AddStudent();

else if (msg.equals("View Faculty Details"))

new TeacherDetails();

else if (msg.equals("View Student Details"))

new StudentDetails();

else if (msg.equals("Faculty Leave"))

new TeacherLeave();

}
else if (msg.equals("Student Leave"))

new StudentLeave();

else if (msg.equals("Faculty Leave Details"))

new TeacherLeaveDetails();

else if (msg.equals("Student Leave Details"))

new StudentLeaveDetails();

else if (msg.equals("Update Faculty Details"))

new UpdateTeacher();

else if (msg.equals("Update Student Details"))

new UpdateStudent();

else if (msg.equals("Enter Marks"))

new EnterMarks();

else if (msg.equals("Examination Results"))

new ExaminationDetails();

else if (msg.equals("Fee Structure"))


{

new FeeStructure();

else if (msg.equals("About"))

new About();

else if (msg.equals("Student Fee Form"))

new StudentFeeForm();

public

static void main(String[] args)

new Project();

}
SPLASH

package university.management.system;

import javax.swing.*;

import java.awt.*;

public

class Splash extends JFrame implements Runnable

Thread t;

Splash()

ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/first.jpg"));

Image i2 = i1.getImage().getScaledInstance(1000, 700, Image.SCALE_DEFAULT);

ImageIcon i3 = new ImageIcon(i2);

JLabel image = new JLabel(i3);

add(image);

t = new Thread(this);

t.start();

setVisible(true);

int x = 1;

for (int i = 2; i <= 600; i += 4, x += 1)

{
setLocation(600 - ((i + x) / 2), 350 - (i / 2));

setSize(i + 3 * x, i + x / 2);

try

Thread.sleep(10);

catch (Exception e)

public

void run()

try

Thread.sleep(7000);

setVisible(false);

// Next Frame new Login();

catch (Exception e)

public

static void main(String[] args)


{

new Splash();

STUDENT DETAILS

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import net.proteanit.sql.DbUtils;

import java.awt.event.*;

public

class StudentDetails extends JFrame implements ActionListener

Choice crollno;

JTable table;

JButton search, print, update, add, cancel;

StudentDetails()
{

getContentPane().setBackground(Color.WHITE);

setLayout(null);

JLabel heading = new JLabel("Search by Roll Number");

heading.setBounds(20, 20, 150, 20);

add(heading);

crollno = new Choice();

crollno.setBounds(180, 20, 150, 20);

add(crollno);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from student");

while (rs.next())

crollno.add(rs.getString("rollno"));

catch (Exception e)

e.printStackTrace();

table = new JTable();

try
{

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from student");

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

e.printStackTrace();

JScrollPane jsp = new JScrollPane(table);

jsp.setBounds(0, 100, 900, 600);

add(jsp);

search = new JButton("Search");

search.setBounds(20, 70, 80, 20);

search.addActionListener(this);

add(search);

print = new JButton("Print");

print.setBounds(120, 70, 80, 20);

print.addActionListener(this);

add(print);

add = new JButton("Add");

add.setBounds(220, 70, 80, 20);

add.addActionListener(this);

add(add);
update = new JButton("Update");

update.setBounds(320, 70, 80, 20);

update.addActionListener(this);

add(update);

cancel = new JButton("Cancel");

cancel.setBounds(420, 70, 80, 20);

cancel.addActionListener(this);

add(cancel);

setSize(900, 700);

setLocation(300, 100);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == search)

String query = "select * from student where rollno = '" + crollno.getSelectedItem() + "'";

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery(query);

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

{
e.printStackTrace();

else if (ae.getSource() == print)

try

table.print();

catch (Exception e)

e.printStackTrace();

else if (ae.getSource() == add)

setVisible(false);

new AddStudent();

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

setVisible(false);

new UpdateStudent();

else

setVisible(false);

}
public

static void main(String[] args)

new StudentDetails();

STUDENT FEE

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import java.awt.event.*;

public

class StudentFeeForm extends JFrame implements ActionListener

Choice crollno;

JComboBox cbcourse, cbbranch, cbsemester;


JLabel labeltotal;

JButton update, pay, back;

StudentFeeForm()

setSize(900, 500);

setLocation(300, 100);

setLayout(null);

getContentPane().setBackground(Color.WHITE);

ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/fee.jpg"));

Image i2 = i1.getImage().getScaledInstance(500, 300, Image.SCALE_DEFAULT);

ImageIcon i3 = new ImageIcon(i2);

JLabel image = new JLabel(i3);

image.setBounds(400, 50, 500, 300);

add(image);

JLabel lblrollnumber = new JLabel("Select Roll No");

lblrollnumber.setBounds(40, 60, 150, 20);

lblrollnumber.setFont(new Font("Tahoma", Font.BOLD, 16));

add(lblrollnumber);

crollno = new Choice();

crollno.setBounds(200, 60, 150, 20);

add(crollno);

try

{
Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from student");

while (rs.next())

crollno.add(rs.getString("rollno"));

catch (Exception e)

e.printStackTrace();

JLabel lblname = new JLabel("Name");

lblname.setBounds(40, 100, 150, 20);

lblname.setFont(new Font("Tahoma", Font.BOLD, 16));

add(lblname);

JLabel labelname = new JLabel();

labelname.setBounds(200, 100, 150, 20);

labelname.setFont(new Font("Tahoma", Font.PLAIN, 16));

add(labelname);

JLabel lblfname = new JLabel("Father's Name");

lblfname.setBounds(40, 140, 150, 20);

lblfname.setFont(new Font("Tahoma", Font.BOLD, 16));

add(lblfname);

JLabel labelfname = new JLabel();

labelfname.setBounds(200, 140, 150, 20);


labelfname.setFont(new Font("Tahoma", Font.PLAIN, 16));

add(labelfname);

try

Conn c = new Conn();

String query = "select * from student where rollno='" + crollno.getSelectedItem() + "'";

ResultSet rs = c.s.executeQuery(query);

while (rs.next())

labelname.setText(rs.getString("name"));

labelfname.setText(rs.getString("fname"));

catch (Exception e)

e.printStackTrace();

crollno.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) {

try {

Conn c = new Conn();

String query = "select * from student where rollno='"+crollno.getSelectedItem()+"'";


ResultSet rs = c.s.executeQuery(query);

while(rs.next()) {

labelname.setText(rs.getString("name"));

labelfname.setText(rs.getString("fname"));

catch (Exception e)
{

e.printStackTrace();

});

JLabel lblcourse = new JLabel("Course");

lblcourse.setBounds(40, 180, 150, 20);

lblcourse.setFont(new Font("Tahoma", Font.BOLD, 16));

add(lblcourse);

String course[] = {"BTech", "BBA", "BCA", "Bsc", "Msc", "MBA", "MCA", "MCom", "MA", "BA"};

cbcourse = new JComboBox(course);

cbcourse.setBounds(200, 180, 150, 20);

cbcourse.setBackground(Color.WHITE);

add(cbcourse);

JLabel lblbranch = new JLabel("Branch");

lblbranch.setBounds(40, 220, 150, 20);

lblbranch.setFont(new Font("Tahoma", Font.BOLD, 16));

add(lblbranch);

String branch[] = {"Computer Science", "Electronics", "Mechanical", "Civil", "IT"};

cbbranch = new JComboBox(branch);

cbbranch.setBounds(200, 220, 150, 20);

cbbranch.setBackground(Color.WHITE);

add(cbbranch);

JLabel lblsemester = new JLabel("Semester");


lblsemester.setBounds(40, 260, 150, 20);

lblsemester.setFont(new Font("Tahoma", Font.BOLD, 16));

add(lblsemester);

String semester[] = {"Semester1", "Semester2", "Semester3", "Semester4", "Semester5",

"Semester6", "Semester7", "Semester8"};

cbsemester = new JComboBox(semester);

cbsemester.setBounds(200, 260, 150, 20);

cbsemester.setBackground(Color.WHITE);

add(cbsemester);

JLabel lbltotal = new JLabel("Total Payable");

lbltotal.setBounds(40, 300, 150, 20);

lbltotal.setFont(new Font("Tahoma", Font.BOLD, 16));

add(lbltotal);

labeltotal = new JLabel();

labeltotal.setBounds(200, 300, 150, 20);

labeltotal.setFont(new Font("Tahoma", Font.PLAIN, 16));

add(labeltotal);

update = new JButton("Update");

update.setBounds(30, 380, 100, 25);

update.setBackground(Color.BLACK);

update.setForeground(Color.WHITE);

update.addActionListener(this);

add(update);

pay = new JButton("Pay Fee");


pay.setBounds(150, 380, 100, 25);

pay.setBackground(Color.BLACK);

pay.setForeground(Color.WHITE);

pay.addActionListener(this);

pay.setFont(new Font("Tahoma", Font.BOLD, 15));

add(pay);

back = new JButton("Back");

back.setBounds(270, 380, 100, 25);

back.setBackground(Color.BLACK);

back.setForeground(Color.WHITE);

back.addActionListener(this);

back.setFont(new Font("Tahoma", Font.BOLD, 15));

add(back);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == update)

String course = (String)cbcourse.getSelectedItem();

String semester = (String)cbsemester.getSelectedItem();

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from fee where course = '" + course + "'");


while (rs.next())

labeltotal.setText(rs.getString(semester));

catch (Exception e)

e.printStackTrace();

else if (ae.getSource() == pay)

String rollno = crollno.getSelectedItem();

String course = (String)cbcourse.getSelectedItem();

String semester = (String)cbsemester.getSelectedItem();

String branch = (String)cbbranch.getSelectedItem();

String total = labeltotal.getText();

try

Conn c = new Conn();

String query = "insert into collegefee values('"+rollno+"', '"+course+"', '"+branch+"',

'"+semester+"', '"+total+"')";

c.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "College fee submitted successfully");

setVisible(false);

catch (Exception e)
{

e.printStackTrace();

else

setVisible(false);

public

static void main(String[] args)

new StudentFeeForm();

STUDENT LEAVE

package university.management.system;

import javax.swing.*;

import java.awt.*;
import java.sql.*;

import com.toedter.calendar.JDateChooser;

import java.awt.event.*;

public

class StudentLeave extends JFrame implements ActionListener

Choice crollno, ctime;

JDateChooser dcdate;

JButton submit, cancel;

StudentLeave()

setSize(500, 550);

setLocation(550, 100);

setLayout(null);

getContentPane().setBackground(Color.WHITE);

JLabel heading = new JLabel("Apply Leave (Student)");

heading.setBounds(40, 50, 300, 30);

heading.setFont(new Font("Tahoma", Font.BOLD, 20));

add(heading);

JLabel lblrollno = new JLabel("Search by Roll Number");

lblrollno.setBounds(60, 100, 200, 20);

lblrollno.setFont(new Font("Tahoma", Font.PLAIN, 18));


add(lblrollno);

crollno = new Choice();

crollno.setBounds(60, 130, 200, 20);

add(crollno);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from student");

while (rs.next())

crollno.add(rs.getString("rollno"));

catch (Exception e)

e.printStackTrace();

JLabel lbldate = new JLabel("Date");

lbldate.setBounds(60, 180, 200, 20);

lbldate.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(lbldate);

dcdate = new JDateChooser();

dcdate.setBounds(60, 210, 200, 25);

add(dcdate);
JLabel lbltime = new JLabel("Time Duration");

lbltime.setBounds(60, 260, 200, 20);

lbltime.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(lbltime);

ctime = new Choice();

ctime.setBounds(60, 290, 200, 20);

ctime.add("Full Day");

ctime.add("Half Day");

add(ctime);

submit = new JButton("Submit");

submit.setBounds(60, 350, 100, 25);

submit.setBackground(Color.BLACK);

submit.setForeground(Color.WHITE);

submit.addActionListener(this);

submit.setFont(new Font("Tahoma", Font.BOLD, 15));

add(submit);

cancel = new JButton("Cancel");

cancel.setBounds(200, 350, 100, 25);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);

cancel.addActionListener(this);

cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

setVisible(true);

}
public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == submit)

String rollno = crollno.getSelectedItem();

String date = ((JTextField)dcdate.getDateEditor().getUiComponent()).getText();

String duration = ctime.getSelectedItem();

String query = "insert into studentleave values('" + rollno + "', '" + date + "', '" + duration +
"')";

try

Conn c = new Conn();

c.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "Leave Confirmed");

setVisible(false);

catch (Exception e)

e.printStackTrace();

else

setVisible(false);

}
public

static void main(String[] args)

new StudentLeave();

} package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import net.proteanit.sql.DbUtils;

import java.awt.event.*;

public

class StudentLeaveDetails extends JFrame implements ActionListener

Choice crollno;

JTable table;

JButton search, print, update, add, cancel;

StudentLeaveDetails()

getContentPane().setBackground(Color.WHITE);

setLayout(null);

JLabel heading = new JLabel("Search by Roll Number");


heading.setBounds(20, 20, 150, 20);

add(heading);

crollno = new Choice();

crollno.setBounds(180, 20, 150, 20);

add(crollno);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from student");

while (rs.next())

crollno.add(rs.getString("rollno"));

catch (Exception e)

e.printStackTrace();

table = new JTable();

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from studentleave");

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)
{

e.printStackTrace();

JScrollPane jsp = new JScrollPane(table);

jsp.setBounds(0, 100, 900, 600);

add(jsp);

search = new JButton("Search");

search.setBounds(20, 70, 80, 20);

search.addActionListener(this);

add(search);

print = new JButton("Print");

print.setBounds(120, 70, 80, 20);

print.addActionListener(this);

add(print);

cancel = new JButton("Cancel");

cancel.setBounds(220, 70, 80, 20);

cancel.addActionListener(this);

add(cancel);

setSize(900, 700);

setLocation(300, 100);

setVisible(true);

public
void actionPerformed(ActionEvent ae)

if (ae.getSource() == search)

String query = "select * from studentleave where rollno = '" + crollno.getSelectedItem() + "'";

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery(query);

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

e.printStackTrace();

else if (ae.getSource() == print)

try

table.print();

catch (Exception e)

e.printStackTrace();

else

{
setVisible(false);

public

static void main(String[] args)

new StudentLeaveDetails();

TEACHER DETAILS

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import net.proteanit.sql.DbUtils;

import java.awt.event.*;

public

class TeacherDetails extends JFrame implements ActionListener

Choice cEmpId;

JTable table;

JButton search, print, update, add, cancel;


TeacherDetails()

getContentPane().setBackground(Color.WHITE);

setLayout(null);

JLabel heading = new JLabel("Search by Employee Id");

heading.setBounds(20, 20, 150, 20);

add(heading);

cEmpId = new Choice();

cEmpId.setBounds(180, 20, 150, 20);

add(cEmpId);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from teacher");

while (rs.next())

cEmpId.add(rs.getString("empId"));

catch (Exception e)

e.printStackTrace();

table = new JTable();

try
{

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from teacher");

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

e.printStackTrace();

JScrollPane jsp = new JScrollPane(table);

jsp.setBounds(0, 100, 900, 600);

add(jsp);

search = new JButton("Search");

search.setBounds(20, 70, 80, 20);

search.addActionListener(this);

add(search);

print = new JButton("Print");

print.setBounds(120, 70, 80, 20);

print.addActionListener(this);

add(print);

add = new JButton("Add");

add.setBounds(220, 70, 80, 20);

add.addActionListener(this);

add(add);
update = new JButton("Update");

update.setBounds(320, 70, 80, 20);

update.addActionListener(this);

add(update);

cancel = new JButton("Cancel");

cancel.setBounds(420, 70, 80, 20);

cancel.addActionListener(this);

add(cancel);

setSize(900, 700);

setLocation(300, 100);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == search)

String query = "select * from teacher where rollno = '" + cEmpId.getSelectedItem() + "'";

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery(query);

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

{
e.printStackTrace();

else if (ae.getSource() == print)

try

table.print();

catch (Exception e)

e.printStackTrace();

else if (ae.getSource() == add)

setVisible(false);

new AddTeacher();

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

setVisible(false);

new UpdateTeacher();

else

setVisible(false);

}
public

static void main(String[] args)

new TeacherDetails();

TEACHER LEAVE

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import com.toedter.calendar.JDateChooser;

import java.awt.event.*;

public

class TeacherLeave extends JFrame implements ActionListener

Choice cEmpId, ctime;


JDateChooser dcdate;

JButton submit, cancel;

TeacherLeave()

setSize(500, 550);

setLocation(550, 100);

setLayout(null);

getContentPane().setBackground(Color.WHITE);

JLabel heading = new JLabel("Apply Leave (Teacher)");

heading.setBounds(40, 50, 300, 30);

heading.setFont(new Font("Tahoma", Font.BOLD, 20));

add(heading);

JLabel lblrollno = new JLabel("Search by Employee Id");

lblrollno.setBounds(60, 100, 200, 20);

lblrollno.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(lblrollno);

cEmpId = new Choice();

cEmpId.setBounds(60, 130, 200, 20);

add(cEmpId);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from teacher");


while (rs.next())

cEmpId.add(rs.getString("empId"));

catch (Exception e)

e.printStackTrace();

JLabel lbldate = new JLabel("Date");

lbldate.setBounds(60, 180, 200, 20);

lbldate.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(lbldate);

dcdate = new JDateChooser();

dcdate.setBounds(60, 210, 200, 25);

add(dcdate);

JLabel lbltime = new JLabel("Time Duration");

lbltime.setBounds(60, 260, 200, 20);

lbltime.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(lbltime);

ctime = new Choice();

ctime.setBounds(60, 290, 200, 20);

ctime.add("Full Day");

ctime.add("Half Day");

add(ctime);
submit = new JButton("Submit");

submit.setBounds(60, 350, 100, 25);

submit.setBackground(Color.BLACK);

submit.setForeground(Color.WHITE);

submit.addActionListener(this);

submit.setFont(new Font("Tahoma", Font.BOLD, 15));

add(submit);

cancel = new JButton("Cancel");

cancel.setBounds(200, 350, 100, 25);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);

cancel.addActionListener(this);

cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == submit)

String rollno = cEmpId.getSelectedItem();

String date = ((JTextField)dcdate.getDateEditor().getUiComponent()).getText();

String duration = ctime.getSelectedItem();


String query = "insert into teacherleave values('" + rollno + "', '" + date + "', '" + duration +
"')";

try

Conn c = new Conn();

c.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "Leave Confirmed");

setVisible(false);

catch (Exception e)

e.printStackTrace();

else

setVisible(false);

public

static void main(String[] args)

new TeacherLeave();

}
TEACHER LEAVE DETAILS

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.sql.*;

import net.proteanit.sql.DbUtils;

import java.awt.event.*;

public

class TeacherLeaveDetails extends JFrame implements ActionListener

Choice cEmpId;

JTable table;

JButton search, print, cancel;

TeacherLeaveDetails()

getContentPane().setBackground(Color.WHITE);

setLayout(null);

JLabel heading = new JLabel("Search by Employee Id");

heading.setBounds(20, 20, 150, 20);

add(heading);

cEmpId = new Choice();


cEmpId.setBounds(180, 20, 150, 20);

add(cEmpId);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from teacher");

while (rs.next())

cEmpId.add(rs.getString("empId"));

catch (Exception e)

e.printStackTrace();

table = new JTable();

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from teacherleave");

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

e.printStackTrace();

}
JScrollPane jsp = new JScrollPane(table);

jsp.setBounds(0, 100, 900, 600);

add(jsp);

search = new JButton("Search");

search.setBounds(20, 70, 80, 20);

search.addActionListener(this);

add(search);

print = new JButton("Print");

print.setBounds(120, 70, 80, 20);

print.addActionListener(this);

add(print);

cancel = new JButton("Cancel");

cancel.setBounds(220, 70, 80, 20);

cancel.addActionListener(this);

add(cancel);

setSize(900, 700);

setLocation(300, 100);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == search)

{
String query = "select * from teacherleave where rollno = '" + cEmpId.getSelectedItem() + "'";

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery(query);

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e)

e.printStackTrace();

else if (ae.getSource() == print)

try

table.print();

catch (Exception e)

e.printStackTrace();

else

setVisible(false);

}
public

static void main(String[] args)

new TeacherLeaveDetails();

UPDATE STUDENTS

package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public

class UpdateStudent extends JFrame implements ActionListener

JTextField tfcourse, tfaddress, tfphone, tfemail, tfbranch;

JLabel labelrollno;

JButton submit, cancel;


Choice crollno;

UpdateStudent()

setSize(900, 650);

setLocation(350, 50);

setLayout(null);

JLabel heading = new JLabel("Update Student Details");

heading.setBounds(50, 10, 500, 50);

heading.setFont(new Font("Tahoma", Font.ITALIC, 35));

add(heading);

JLabel lblrollnumber = new JLabel("Select Roll Number");

lblrollnumber.setBounds(50, 100, 200, 20);

lblrollnumber.setFont(new Font("serif", Font.PLAIN, 20));

add(lblrollnumber);

crollno = new Choice();

crollno.setBounds(250, 100, 200, 20);

add(crollno);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from student");

while (rs.next())

{
crollno.add(rs.getString("rollno"));

catch (Exception e)

e.printStackTrace();

JLabel lblname = new JLabel("Name");

lblname.setBounds(50, 150, 100, 30);

lblname.setFont(new Font("serif", Font.BOLD, 20));

add(lblname);

JLabel labelname = new JLabel();

labelname.setBounds(200, 150, 150, 30);

labelname.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelname);

JLabel lblfname = new JLabel("Father's Name");

lblfname.setBounds(400, 150, 200, 30);

lblfname.setFont(new Font("serif", Font.BOLD, 20));

add(lblfname);

JLabel labelfname = new JLabel();

labelfname.setBounds(600, 150, 150, 30);

labelfname.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelfname);

JLabel lblrollno = new JLabel("Roll Number");


lblrollno.setBounds(50, 200, 200, 30);

lblrollno.setFont(new Font("serif", Font.BOLD, 20));

add(lblrollno);

labelrollno = new JLabel();

labelrollno.setBounds(200, 200, 200, 30);

labelrollno.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelrollno);

JLabel lbldob = new JLabel("Date of Birth");

lbldob.setBounds(400, 200, 200, 30);

lbldob.setFont(new Font("serif", Font.BOLD, 20));

add(lbldob);

JLabel labeldob = new JLabel();

labeldob.setBounds(600, 200, 150, 30);

labeldob.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labeldob);

JLabel lbladdress = new JLabel("Address");

lbladdress.setBounds(50, 250, 200, 30);

lbladdress.setFont(new Font("serif", Font.BOLD, 20));

add(lbladdress);

tfaddress = new JTextField();

tfaddress.setBounds(200, 250, 150, 30);

add(tfaddress);

JLabel lblphone = new JLabel("Phone");


lblphone.setBounds(400, 250, 200, 30);

lblphone.setFont(new Font("serif", Font.BOLD, 20));

add(lblphone);

tfphone = new JTextField();

tfphone.setBounds(600, 250, 150, 30);

add(tfphone);

JLabel lblemail = new JLabel("Email Id");

lblemail.setBounds(50, 300, 200, 30);

lblemail.setFont(new Font("serif", Font.BOLD, 20));

add(lblemail);

tfemail = new JTextField();

tfemail.setBounds(200, 300, 150, 30);

add(tfemail);

JLabel lblx = new JLabel("Class X (%)");

lblx.setBounds(400, 300, 200, 30);

lblx.setFont(new Font("serif", Font.BOLD, 20));

add(lblx);

JLabel labelx = new JLabel();

labelx.setBounds(600, 300, 150, 30);

labelx.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelx);

JLabel lblxii = new JLabel("Class XII (%)");

lblxii.setBounds(50, 350, 200, 30);


lblxii.setFont(new Font("serif", Font.BOLD, 20));

add(lblxii);

JLabel labelxii = new JLabel();

labelxii.setBounds(200, 350, 150, 30);

labelxii.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelxii);

JLabel lblaadhar = new JLabel("Aadhar Number");

lblaadhar.setBounds(400, 350, 200, 30);

lblaadhar.setFont(new Font("serif", Font.BOLD, 20));

add(lblaadhar);

JLabel labelaadhar = new JLabel();

labelaadhar.setBounds(600, 350, 150, 30);

labelaadhar.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelaadhar);

JLabel lblcourse = new JLabel("Course");

lblcourse.setBounds(50, 400, 200, 30);

lblcourse.setFont(new Font("serif", Font.BOLD, 20));

add(lblcourse);

tfcourse = new JTextField();

tfcourse.setBounds(200, 400, 150, 30);

add(tfcourse);

JLabel lblbranch = new JLabel("Branch");

lblbranch.setBounds(400, 400, 200, 30);


lblbranch.setFont(new Font("serif", Font.BOLD, 20));

add(lblbranch);

tfbranch = new JTextField();

tfbranch.setBounds(600, 400, 150, 30);

add(tfbranch);

try

Conn c = new Conn();

String query = "select * from student where rollno='" + crollno.getSelectedItem() + "'";

ResultSet rs = c.s.executeQuery(query);

while (rs.next())

labelname.setText(rs.getString("name"));

labelfname.setText(rs.getString("fname"));

labeldob.setText(rs.getString("dob"));

tfaddress.setText(rs.getString("address"));

tfphone.setText(rs.getString("phone"));

tfemail.setText(rs.getString("email"));

labelx.setText(rs.getString("class_x"));

labelxii.setText(rs.getString("class_xii"));

labelaadhar.setText(rs.getString("aadhar"));

labelrollno.setText(rs.getString("rollno"));

tfcourse.setText(rs.getString("course"));

tfbranch.setText(rs.getString("branch"));

catch (Exception e)
{

e.printStackTrace();

crollno.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) {

try {

Conn c = new Conn();

String query = "select * from student where rollno='"+crollno.getSelectedItem()+"'";


ResultSet rs = c.s.executeQuery(query); while(rs.next()) {

labelname.setText(rs.getString("name"));

labelfname.setText(rs.getString("fname"));

labeldob.setText(rs.getString("dob"));

tfaddress.setText(rs.getString("address"));

tfphone.setText(rs.getString("phone"));

tfemail.setText(rs.getString("email"));

labelx.setText(rs.getString("class_x"));

labelxii.setText(rs.getString("class_xii"));

labelaadhar.setText(rs.getString("aadhar"));

labelrollno.setText(rs.getString("rollno"));

tfcourse.setText(rs.getString("course"));

tfbranch.setText(rs.getString("branch"));

catch (Exception e)

e.printStackTrace();

});
submit = new JButton("Update");

submit.setBounds(250, 500, 120, 30);

submit.setBackground(Color.BLACK);

submit.setForeground(Color.WHITE);

submit.addActionListener(this);

submit.setFont(new Font("Tahoma", Font.BOLD, 15));

add(submit);

cancel = new JButton("Cancel");

cancel.setBounds(450, 500, 120, 30);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);

cancel.addActionListener(this);

cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == submit)

String rollno = labelrollno.getText();

String address = tfaddress.getText();

String phone = tfphone.getText();

String email = tfemail.getText();


String course = tfcourse.getText();

String branch = tfbranch.getText();

try

String query = "update student set address='" + address + "', phone='" + phone + "', email='"
+ email + "', course='" + course + "', branch='" + branch + "' where rollno='" + rollno + "'";

Conn con = new Conn();

con.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "Student Details Updated Successfully");

setVisible(false);

catch (Exception e)

e.printStackTrace();

else

setVisible(false);

public

static void main(String[] args)

new UpdateStudent();

}
package university.management.system;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

public

class UpdateTeacher extends JFrame implements ActionListener

JTextField tfcourse, tfaddress, tfphone, tfemail, tfbranch;

JLabel labelEmpId;

JButton submit, cancel;

Choice cEmpId;

UpdateTeacher()

setSize(900, 650);

setLocation(350, 50);

setLayout(null);

JLabel heading = new JLabel("Update Teacher Details");

heading.setBounds(50, 10, 500, 50);

heading.setFont(new Font("Tahoma", Font.ITALIC, 35));

add(heading);
JLabel lblrollnumber = new JLabel("Select Employee Id");

lblrollnumber.setBounds(50, 100, 200, 20);

lblrollnumber.setFont(new Font("serif", Font.PLAIN, 20));

add(lblrollnumber);

cEmpId = new Choice();

cEmpId.setBounds(250, 100, 200, 20);

add(cEmpId);

try

Conn c = new Conn();

ResultSet rs = c.s.executeQuery("select * from teacher");

while (rs.next())

cEmpId.add(rs.getString("empId"));

catch (Exception e)

e.printStackTrace();

JLabel lblname = new JLabel("Name");

lblname.setBounds(50, 150, 100, 30);

lblname.setFont(new Font("serif", Font.BOLD, 20));

add(lblname);

JLabel labelname = new JLabel();


labelname.setBounds(200, 150, 150, 30);

labelname.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelname);

JLabel lblfname = new JLabel("Father's Name");

lblfname.setBounds(400, 150, 200, 30);

lblfname.setFont(new Font("serif", Font.BOLD, 20));

add(lblfname);

JLabel labelfname = new JLabel();

labelfname.setBounds(600, 150, 150, 30);

labelfname.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelfname);

JLabel lblrollno = new JLabel("Employee Id");

lblrollno.setBounds(50, 200, 200, 30);

lblrollno.setFont(new Font("serif", Font.BOLD, 20));

add(lblrollno);

labelEmpId = new JLabel();

labelEmpId.setBounds(200, 200, 200, 30);

labelEmpId.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelEmpId);

JLabel lbldob = new JLabel("Date of Birth");

lbldob.setBounds(400, 200, 200, 30);

lbldob.setFont(new Font("serif", Font.BOLD, 20));

add(lbldob);
JLabel labeldob = new JLabel();

labeldob.setBounds(600, 200, 150, 30);

labeldob.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labeldob);

JLabel lbladdress = new JLabel("Address");

lbladdress.setBounds(50, 250, 200, 30);

lbladdress.setFont(new Font("serif", Font.BOLD, 20));

add(lbladdress);

tfaddress = new JTextField();

tfaddress.setBounds(200, 250, 150, 30);

add(tfaddress);

JLabel lblphone = new JLabel("Phone");

lblphone.setBounds(400, 250, 200, 30);

lblphone.setFont(new Font("serif", Font.BOLD, 20));

add(lblphone);

tfphone = new JTextField();

tfphone.setBounds(600, 250, 150, 30);

add(tfphone);

JLabel lblemail = new JLabel("Email Id");

lblemail.setBounds(50, 300, 200, 30);

lblemail.setFont(new Font("serif", Font.BOLD, 20));

add(lblemail);

tfemail = new JTextField();


tfemail.setBounds(200, 300, 150, 30);

add(tfemail);

JLabel lblx = new JLabel("Class X (%)");

lblx.setBounds(400, 300, 200, 30);

lblx.setFont(new Font("serif", Font.BOLD, 20));

add(lblx);

JLabel labelx = new JLabel();

labelx.setBounds(600, 300, 150, 30);

labelx.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelx);

JLabel lblxii = new JLabel("Class XII (%)");

lblxii.setBounds(50, 350, 200, 30);

lblxii.setFont(new Font("serif", Font.BOLD, 20));

add(lblxii);

JLabel labelxii = new JLabel();

labelxii.setBounds(200, 350, 150, 30);

labelxii.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelxii);

JLabel lblaadhar = new JLabel("Aadhar Number");

lblaadhar.setBounds(400, 350, 200, 30);

lblaadhar.setFont(new Font("serif", Font.BOLD, 20));

add(lblaadhar);

JLabel labelaadhar = new JLabel();


labelaadhar.setBounds(600, 350, 150, 30);

labelaadhar.setFont(new Font("Tahoma", Font.PLAIN, 18));

add(labelaadhar);

JLabel lblcourse = new JLabel("Education");

lblcourse.setBounds(50, 400, 200, 30);

lblcourse.setFont(new Font("serif", Font.BOLD, 20));

add(lblcourse);

tfcourse = new JTextField();

tfcourse.setBounds(200, 400, 150, 30);

add(tfcourse);

JLabel lblbranch = new JLabel("Department");

lblbranch.setBounds(400, 400, 200, 30);

lblbranch.setFont(new Font("serif", Font.BOLD, 20));

add(lblbranch);

tfbranch = new JTextField();

tfbranch.setBounds(600, 400, 150, 30);

add(tfbranch);

try

Conn c = new Conn();

String query = "select * from teacher where empId='" + cEmpId.getSelectedItem() + "'";

ResultSet rs = c.s.executeQuery(query);

while (rs.next())

{
labelname.setText(rs.getString("name"));

labelfname.setText(rs.getString("fname"));

labeldob.setText(rs.getString("dob"));

tfaddress.setText(rs.getString("address"));

tfphone.setText(rs.getString("phone"));

tfemail.setText(rs.getString("email"));

labelx.setText(rs.getString("class_x"));

labelxii.setText(rs.getString("class_xii"));

labelaadhar.setText(rs.getString("aadhar"));

labelEmpId.setText(rs.getString("empId"));

tfcourse.setText(rs.getString("education"));

tfbranch.setText(rs.getString("department"));

catch (Exception e)

e.printStackTrace();

cEmpId.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) {

try {

Conn c = new Conn();

String query = "select * from teacher where empId='"+cEmpId.getSelectedItem()+"'";


ResultSet rs = c.s.executeQuery(query); while(rs.next()) {

labelname.setText(rs.getString("name"));

labelfname.setText(rs.getString("fname"));

labeldob.setText(rs.getString("dob"));

tfaddress.setText(rs.getString("address"));

tfphone.setText(rs.getString("phone"));
tfemail.setText(rs.getString("email"));

labelx.setText(rs.getString("class_x"));

labelxii.setText(rs.getString("class_xii"));

labelaadhar.setText(rs.getString("aadhar"));

labelEmpId.setText(rs.getString("empId"));

tfcourse.setText(rs.getString("education"));

tfbranch.setText(rs.getString("department"));

catch (Exception e)

e.printStackTrace();

});

submit = new JButton("Update");

submit.setBounds(250, 500, 120, 30);

submit.setBackground(Color.BLACK);

submit.setForeground(Color.WHITE);

submit.addActionListener(this);

submit.setFont(new Font("Tahoma", Font.BOLD, 15));

add(submit);

cancel = new JButton("Cancel");

cancel.setBounds(450, 500, 120, 30);

cancel.setBackground(Color.BLACK);

cancel.setForeground(Color.WHITE);

cancel.addActionListener(this);
cancel.setFont(new Font("Tahoma", Font.BOLD, 15));

add(cancel);

setVisible(true);

public

void actionPerformed(ActionEvent ae)

if (ae.getSource() == submit)

String empId = labelEmpId.getText();

String address = tfaddress.getText();

String phone = tfphone.getText();

String email = tfemail.getText();

String course = tfcourse.getText();

String branch = tfbranch.getText();

try

String query = "update teacher set address='" + address + "', phone='" + phone + "', email='"
+ email + "', education='" + course + "', department='" + branch + "' where empId='" + empId + "'";

Conn con = new Conn();

con.s.executeUpdate(query);

JOptionPane.showMessageDialog(null, "Student Details Updated Successfully");

setVisible(false);

catch (Exception e)

{
e.printStackTrace();

else

setVisible(false);

public

static void main(String[] args)

new UpdateTeacher();

You might also like