Professional Documents
Culture Documents
Submitted by:
Concepcion, Klent
Cabaya, Geraldine
Barcarcil, Almar Jay
Maraon, Bernard Gaspar
October 2022
Description of the Study
Nowadays we are surrounded by technology and people rely on technology in their
daily lives. Computers have become more important due to their improved productivity
and efficiency. The computer is capable of storing large volumes of data. Student
Management System (SMS) is one system that serves as both a building block of
information and a source of instruction for students. To keep all of the most recent
records of the students as simple as possible, they must maintain a proper database of
the student.
One of the main problems with traditional enrollment is they need to write their
information on a registration form and the registration staff will manually type does
information into excel. The challenges encountered by the registration staff are the
technical errors. Which takes more time and effort for the registration staff. We develop
this system to help our registration staff to aid with this problem.
This system is developed for academic purposes. The registration staff can use
Student Information System (SIS) to register and maintain all the personal information
of the students they provide, including their full name, parent's maiden name, gender,
physical address, contact information, academic year, and Strand. The system can only
manipulate by the registration staff by managing ( add, update, delete, search, edit). To
in sure the registration staff will be able to get the complete information of the students,
our system will give a prompt message if there is missing information (red highlighted
*). Aside from, we also require to accept the terms and conditions for the privacy of the
students. Since the student will provide sperosnal information, if not it will give the
prompt message (please accept the terms and conditions).
The Student Management System has improved the effectiveness and efficiency of
the education sector. With its well-organized information, user-friendly, and dependable
}
});
}
@SuppressWarnings("unlikely-arg-type")
public static void login (String username, String password, boolean isChecked)
{
if(username.equals("")) {
errorMessage("Please type your username", "Error");
return;
}
if(password.equals("")) {
errorMessage("Please type your password", "Error");
return;
}
if(!isChecked) {
errorMessage("Please check the Terms and Conditions", "Error");
return;
}
try {
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/studentdb","root","");
Statement stm=con.createStatement();
String sql="Select * from login where user='"+txtUser.getText()+"'
and pass = '"+txtPassword.getText().toString()+"'";
ResultSet rs=stm.executeQuery(sql);
if(rs.next()) {
successMessage("Login Succesfull", "Success");
Student newform = new Student();
newform.main(null);
frame.setVisible(false);
}
else
errorMessage("Invalid Account! Please try again!", "Error");
txtUser.setText("");
txtPassword.setText("");
return;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void successMessage(String info, String status) {
JOptionPane.showMessageDialog(null, info, status,
JOptionPane.INFORMATION_MESSAGE);
}
public static void errorMessage(String error, String status) {
JOptionPane.showMessageDialog(null, error, status,
JOptionPane.INFORMATION_MESSAGE);
}
public static void register(String username, String password, boolean
isChecked) {
if(username.equals("")) {
errorMessage("Please type your username", "Error");
return;
}
if(password.equals("")) {
errorMessage("Please type your password", "Error");
return;
}
if(!isChecked) {
errorMessage("Please check the Terms and Conditions", "Error");
return;
}
StudentMenu Class
package GUIPROJECT;
import java.awt.EventQueue;
import java.util.*;
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTabbedPane;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextPane;
import javax.swing.JEditorPane;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import net.proteanit.sql.DbUtils;
import javax.swing.JScrollPane;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
JFrame frame;
JPanel contentPane;
JTextField Fstnm;
JTextField Lstnm;
JTextField Mname;
JTextField Cnctnm;
JTextField Address;
JTextField FstP;
JTextField LstP;
JTextField MP;
JTextField FstP1;
JTextField LstP1;
JTextField MP1;
JButton btnAddstnd, Show,btnInfo,Logout;
JComboBox Strand, Semc,Year,Sex;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Student window = new Student();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
//for backup
File file = new File("data.txt");
private JTable table;
//for database connection
Connection con;
PreparedStatement pst;
ResultSet rs;
private JTable table_1;
public void connect() {
try {
Class.forName("com.mysql.jdbc.Driver");
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/studentdb","root","");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public Student() {
initialize();
connect();
createFile();
}
//create txtfile backup
public void createFile() {
if(!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 1739, 701);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
MP = new JTextField();
MP.setToolTipText("");
MP.setColumns(10);
MP.setBounds(863, 433, 137, 20);
panel_2.add(MP);
row values
that will input from all the txtfields
pst=con.prepareStatement("insert into
student(First_Name,Last_Name,Middle_Name,Contact_No,Address,Sex,Strand,Year,Sem
,First_Namep,Last_Namep,Middle_Namep,First_Namepp,Last_Namepp,Middle_Namepp)
values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
pst.setString(1, Fstnms);
pst.setString(2, Lstnms);
pst.setString(3, Mnames);
pst.setString(4, Cnctnms);
pst.setString(5, Addresss);
pst.setString(6, Sexs);
pst.setString(7, Strnds);
pst.setString(8, Yrs);
pst.setString(9, Semtxts);
pst.setString(10, FstPs);
pst.setString(11, LstPs);
pst.setString(12, MPs);
pst.setString(13, FstP1s);
pst.setString(14, LstP1s);
pst.setString(15, MP1s);
pst.executeUpdate();
insertData();
display();
clear();
}catch(SQLException e1) {
LoginCon.errorMessage("Wrong Contact Number Details
Please try again", "ERROR");
Cnctnm.setText("");
e1.printStackTrace();
}
//createFile();
//insertData();
//clear();
}
}
});
}
public void insertData() {
line();
try {//to access the txtfile where ever it is located
RandomAccessFile ran = new RandomAccessFile(file,"rw");
int line =0;
for(int i=0;i<=line ;i++) {
ran.readLine();
}
ran.writeBytes(Fstnm.getText()+","+Lstnm.getText()
+","+Mname.getText()+","+Cnctnm.getText()+","+Address.getText()
+","+Sex.getSelectedItem().toString()+","+Strand.getSelectedItem().toString()
+","+Year.getSelectedItem().toString()+","+Semc.getSelectedItem().toString()
+","+FstP.getText()+","+LstP.getText()+","+MP.getText()+","+FstP1.getText()
+","+LstP1.getText()+","+MP1.getText());
ran.writeBytes(System.lineSeparator());
ran.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void clear() {//clear method
Fstnm.setText("");
Lstnm.setText("");
Mname.setText("");
Cnctnm.setText("");
Address.setText("");
FstP.setText("");
LstP.setText("");
MP.setText("");
FstP1.setText("");
LstP1.setText("");
MP1.setText("");
Fstnm.requestFocus();
}
public void line() {//read the line and if the line is null the next value will print
int line = 0;
try {
RandomAccessFile ran = new RandomAccessFile(file,"rw");
while(ran.readLine() !=null) {
line++;
}
ran.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void display() {//get the database value then display it in the table
try {
pst = con.prepareStatement("select * from student");
rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
}catch(SQLException e) {
e.printStackTrace();
}
}public void Logout() {
Logout.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int go = JOptionPane.showConfirmDialog(null,
"Do you want to logout?", "Are you sure?",
JOptionPane.YES_NO_OPTION);
if(go==JOptionPane.YES_OPTION)
{ JOptionPane.showMessageDialog(MP, "Thank You for using the system!");
LoginCon newform = new LoginCon();
newform.main(null);
frame.setVisible(false);
}
}
});
}public void ifs(String a,String b,String c,String d,String e,String f,String g,String
h,String i,String j,String k) {
String
Fstnms,Lstnms,Mnames,Cnctnms,Addresss,Sexs,Strnds,Yrs,Semtxts,FstPs,LstPs,MPs,Fst
P1s,LstP1s,MP1s;
Fstnms=Fstnm.getText();//get all the textfield values then store it in the
string values
Lstnms=Lstnm.getText();
Mnames=Mname.getText();
Cnctnms=Cnctnm.getText();
Addresss=Address.getText();
FstPs=FstP.getText();
LstPs=LstP.getText();
MPs=MP.getText();
FstP1s=FstP1.getText();
LstP1s=LstP1.getText();
MP1s=MP1.getText();
if(Fstnms.equals("")||Lstnms.equals("")||Mnames.equals("")||
Cnctnms.equals("")||Addresss.equals("")||FstPs.equals("")||LstPs.equals("")||
MPs.equals("")||FstP1s.equals("")||LstP1s.equals("")||MP1s.equals("")) {
LoginCon.errorMessage("Empty textfield", "ERROR");
return;
}
JOptionPane.showMessageDialog(MP, "Successfully Added");
}
}
Update Class
package GUIPROJECT;
import java.awt.EventQueue;
import javax.swing.JFrame;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Update window = new Update();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Update() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
public void initialize() {
frame = new JFrame();
frame.getContentPane().setBackground(new Color(128, 128, 128));
frame.setBounds(100, 100, 748, 439);
frame.getContentPane().setLayout(null);
Sx = new JTextField();
Sx.setToolTipText("");
Sx.setColumns(10);
Sx.setBounds(600, 123, 137, 20);
frame.getContentPane().add(Sx);
Yr = new JTextField();
Yr.setToolTipText("");
Yr.setColumns(10);
Yr.setBounds(378, 173, 71, 20);
frame.getContentPane().add(Yr);
Sm = new JTextField();
Sm.setToolTipText("");
Sm.setColumns(10);
Sm.setBounds(84, 175, 71, 20);
frame.getContentPane().add(Sm);
if(rs.next()==true)
{ //if the id is found on the database, the blank
txtfields will be filled
String
Fstnms,Lstnms,Mnames,Cnctnms,Addresss,Sexs,Strnds,Yrs,Semtxts,FstPs,LstPs,MPs,Fst
P1s,LstP1s,MP1s;
Fstnms = rs.getString(1);
Lstnms = rs.getString(2);
Mnames = rs.getString(3);
Cnctnms = rs.getString(4);
Addresss = rs.getString(5);
Sexs = rs.getString(6);
Strnds = rs.getString(7);
Yrs = rs.getString(8);
Semtxts = rs.getString(9);
FstPs = rs.getString(10);
LstPs = rs.getString(11);
MPs = rs.getString(12);
FstP1s = rs.getString(13);
LstP1s = rs.getString(14);
MP1s = rs.getString(15);
fname.setText(Fstnms);
Lname.setText(Lstnms);
Middlenm.setText(Mnames);
Cntcnm.setText(Cnctnms);
address.setText(Addresss);
Sx.setText(Sexs);
Strnd.setText(Strnds);
Yr.setText(Yrs);
Sm.setText(Semtxts);
Fnamep.setText(FstPs);
Lnamep.setText(LstPs);
Middlep.setText(MPs);
Fnamep1.setText(FstP1s);
Lnamep1.setText(LstP1s);
Middlep1.setText(MP1s);
}
else
{
clear();
}
}
catch (SQLException ex) {
}
}
});
}
});
SID.setToolTipText("");
SID.setColumns(10);
SID.setBounds(102, 379, 71, 20);
frame.getContentPane().add(SID);