Ajp - Microproject Simple
Ajp - Microproject Simple
PROJECT REPORT
ON
“EXAM REGISTRATION FORM”
Subject – Advanced Java (22517)
SUBMITTED BY
124-Patil Sanskruti Dilip (2100340239)
Under the guidance of
Mr. K. P. Jadhav
1
Sanjivani Rural Education Society’s
SANJIVANI K.B.P POLYTECHNIC
DEPARTMENT OF COMPUTER TECHNOLOGY
CERTIFICATE
This is to certify that the Project report entitled
“EXAM REGISTRATION FORM”
Submitted By
124-Patil Sanskruti Dilip (2100340239)
Under our supervision and guidance for partial fulfillment of
the requirement for
Diploma in Computer Technology affiliated to
Maharashtra State Board of Technical Education, Mumbai
For academic year 2023-2024
2
ACKNOWLEDGEMENT
3
INDEX
1. Introduction 5
2. Algorithm 6
3. Flowchart 7
4. Program Code 8-13
5. Output 14-15
6. References 15
4
INTRODUCTION
5
ALGORITHM
6
FLOWCHART
START
filled
If (row
affected>0)
STOP
7
PROGRAM CODE
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.awt.Font;
import java.sql.*;
public class java_microproject extends JFrame implements ActionListener
{
JLabel l1,l2,l3,l4,l5,l6,l7;
JTextField t1,t2,t3;
JRadioButton r1,r2,r3;
JComboBox<String> cb,cb2;
String studentCourse= "";
String selectedScheme, selectedSem, division, course[],course2[],rollNo;
JButton b1,b2;
ButtonGroup bg;
String studentName;
JPanel jp;
String enrollNo="";
int rowsAffected;
java_microproject()
{
setLayout(null);
l1=new JLabel("EXAM REGISTRATION FORM");
l1.setFont(new Font("Serif", Font.PLAIN, 24));
l1.setBounds(200, 50, 500, 40);
8
add(l1);
9
bg.add(r2);
bg.add(r3);
add(r1);
add(r2);
add(r3);
String[] course={"","A","B","C","D","E","I"};
cb=new JComboBox<>(course);
cb.setBounds(200, 340, 150, 40);
add(cb);
t2=new JTextField();
t2.setBounds(230, 400, 150, 40);
add(t2);
10
l6.setBounds(60, 470, 360, 40);
add(l6);
b1=new JButton("Submit");
b1.setBackground(Color.green);
b1.setFont(new Font("Serif", Font.BOLD, 20));
b1.setBounds(75, 590, 150, 40);
add(b1);
b2=new JButton("Cancel");
b2.setBackground(Color.red);
b2.setFont(new Font("Serif", Font.BOLD, 20));
b2.setBounds(245, 590, 150, 40);
add(b2);
l7=new JLabel();
l7.setFont(new Font("Serif", Font.PLAIN, 18));
l7.setBounds(70, 630, 200, 40);
add(l7);
b1.addActionListener(this);
b2.addActionListener(this);
11
setSize(900, 900);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e)
{
studentName = t1.getText();
enrollNo = t2.getText();
if(e.getSource() == b2){
t1.setText("");
t2.setText(" ");
bg.clearSelection();
cb.setSelectedIndex(-1);
cb2.setSelectedIndex(-1);
}
if (r1.isSelected()) {
studentCourse ="Diploma in Computer Technology";
} else if (r2.isSelected()) {
studentCourse ="Diploma in Mechanical Engineering";
} else if (r3.isSelected()) {
studentCourse ="Diploma in Civil Engineering";
}
selectedSem = (String)cb.getSelectedItem();
selectedScheme = (String)cb2.getSelectedItem();
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
12
Connection con =
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system",
"sanskruti");
Statement stmt = con.createStatement();
if(studentName!="" && studentCourse!="" && selectedScheme!="" &&
selectedSem!="" && enrollNo!=""){
String query="insert into details
values('"+studentName+"','"+studentCourse+"','"+selectedScheme+"','"+enrollN
o+"','"+selectedSem+"')";
rowsAffected = stmt.executeUpdate(query);
}
if (rowsAffected > 0) {
l7.setText("Form filled Successfully!!");
} else {
l7.setText("Failed to fill form!!");
}
con.close();
} catch (Exception ex)
{System.out.println(ex);}
}
public static void main(String args[]) {
new java_microproject();
}
}
13
OUTPUT
14
REFERENCES
1. https://www.w3schools.com/sql/sql_create_table.asp
2. https://www.geeksforgeeks.org/introduction-to-java-swing/
15