3. INTRODUCTION
Our project explains about the student
management. This project mainly explains the
various actions related to student details. This
project shows some ease in adding, editing and
deleting the student details. It also provides a
less time consuming process for viewing, adding,
editing and deleting the marks of the students
Presentation title 3 20XX
4. 20XX
Presentation title 4
Source code: College management System
package collegemangementsystem;
import java.sql.*;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class CollegeMangementSystem {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println(" JDBC Start ");
System.out.println("Programis running on gui...");
HomePage hp = new HomePage();
hp.setVisible(true);
}
}
5. 20XX
Presentation title 5
Source code: Homepage.java
package collegemangementsystem;
public class HomePage extends javax.swing.JFrame {
public HomePage() {
initComponents();
}
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("HomePage");
setBackground(new java.awt.Color(255, 255, 102));
12. 20XX
Presentation title 12
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println("Add new Student detail btn Clicked");
System.out.println("StudentLoginPage GUI Page Open");
StudentLoginPage slp = new StudentLoginPage();
slp.setVisible(true);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println("Delete Student detail tn clicked.");
System.out.println("Delete Frame OPened.");
DeleteStudentDetails dsd = new DeleteStudentDetails();
dsd.setVisible(true);
}
13. 20XX
Presentation title 13
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println("Clicked Update Btn ");
UpdateDetailsPage upd = new UpdateDetailsPage();
upd.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
15. 20XX
Presentation title 15
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new HomePage().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
16. 20XX
Presentation title 16
Source code: Home page.java
package collegemangementsystem;
/**
*
* @author kishor
*/
public class HomePage extends javax.swing.JFrame {
/**
* Creates new form HomePage
*/
public HomePage() {
initComponents();
}
17. 20XX
Presentation title 17
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("HomePage");
setBackground(new java.awt.Color(255, 255, 102));
24. 20XX
Presentation title 24
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println("Add new Student detail btn Clicked");
System.out.println("StudentLoginPage GUI Page Open");
StudentLoginPage slp = new StudentLoginPage();
slp.setVisible(true);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println("Delete Student detail tn clicked.");
System.out.println("Delete Frame OPened.");
DeleteStudentDetails dsd = new DeleteStudentDetails();
dsd.setVisible(true);
}
25. 20XX
Presentation title 25
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println("Clicked Update Btn ");
UpdateDetailsPage upd = new UpdateDetailsPage();
upd.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
26. 20XX
Presentation title 26
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(HomePage.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(HomePage.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(HomePage.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(HomePage.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);
}
//</editor-fold>
/* Create and display the form */
27. 20XX
Presentation title 27
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
28. 20XX
Presentation title 28
Source code: Search page.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package collegemangementsystem;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
29. 20XX
Presentation title 29
public class SearchPage extends javax.swing.JFrame {
/**
* Creates new form SearchPage
*/
public SearchPage() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
30. 20XX
Presentation title 30
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tb1 = new javax.swing.JTable();
setBackground(new java.awt.Color(204, 255, 204));
40. 20XX
Presentation title 40
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jTextField1.setText(" ");
System.out.println(" Cleared ");
tb1.setModel(new DefaultTableModel());
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
42. 20XX
Presentation title 42
Source code: Student Login page.Java
package collegemangementsystem;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import java.sql.*;
public class StudentLoginPage extends javax.swing.JFrame {
public StudentLoginPage() {
initComponents();
}
43. 20XX
Presentation title 43
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
52. 20XX
Presentation title 52
Source code: Update details page.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package collegemangementsystem;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
53. 20XX
Presentation title 53
public class UpdateDetailsPage extends javax.swing.JFrame {
/**
* Creates new form UpdateDetailsPage
*/
public UpdateDetailsPage() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
54. 20XX
Presentation title 54
private void initComponents() {
jLabel2 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
tf1 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jTextField5 = new javax.swing.JTextField();
64. 20XX
Presentation title 64
// TODO add your handling code here:
String url = "jdbc:mysql://localhost:3306/stinfo";
String user = "root";
String password = "";
Connection con = DriverManager.getConnection(url, user, password);
Statement st = con.createStatement();
String Tf1 = tf1.getText();
String queryDel = "update Students set
dept='"+tfDept+"',Email='"+tfEmail+"',Mobile='"+tfMob+"',Name='"+tfName+"'";
int res= st.executeUpdate(queryDel);
System.out.println("Result = "+ res);
}catch (SQLException ex) {
System.out.println("Some Other error Occured");
}
}
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
65. 20XX
Presentation title 65
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
{
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(UpdateDetailsPage.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(UpdateDetailsPage.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
66. 20XX
Presentation title 66
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(UpdateDetailsPage.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(UpdateDetailsPage.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new UpdateDetailsPage().setVisible(true);
}
});
}
68. 20XX
Presentation title 68
Source code: Delete student details.Java
*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package collegemangementsystem;
import javax.swing.JOptionPane;
import java.sql.*;
/**
69. 20XX
Presentation title 69
public class DeleteStudentDetails extends javax.swing.JFrame {
/**
* Creates new form DeleteStudentDetails
*/
public DeleteStudentDetails() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
70. 20XX
Presentation title 70
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel1.setText("Student Id:");
jTextField1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jButton1.setBackground(new java.awt.Color(255, 204, 204));
jButton1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jButton1.setForeground(new java.awt.Color(255, 0, 51));
jButton1.setText("Delete");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
75. 20XX
Presentation title 75
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
// TODO add your handling code here:
String url = "jdbc:mysql://localhost:3306/stinfo";
String user = "root";
String password = "";
Connection con = DriverManager.getConnection(url, user, password);
Statement st = con.createStatement();
String Tf1 = jTextField1.getText();
String queryDel = "Delete from Students where reg = "+Tf1;
int res= st.executeUpdate(queryDel);
System.out.println("Result = "+ res);
if(res==1){
System.out.println("deleted Sucessfully ");
JOptionPane.showMessageDialog(rootPane," Delete Sucessful. ");
}
76. 20XX
Presentation title 76
else{
System.out.println("No any such id found ");
JOptionPane.showMessageDialog(rootPane," No any such id found ");
}
}catch (SQLException ex) {
System.out.println("Some Other error Occured");
}
// Logger.getLogger(DeleteStudentDetails.class.getName()).log(Level.SEVERE, null, ex);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jTextField1.setText(" ");
}
/**
* @param argsthe command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
77. 20XX
Presentation title 77
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(DeleteStudentDetails.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(DeleteStudentDetails.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(DeleteStudentDetails.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);
78. 20XX
Presentation title 78
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(DeleteStudentDetails.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DeleteStudentDetails().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField jTextField1; }