ajp_microproject
ajp_microproject
PROJECT REPORT
ON
“EXAM REGISTRATION FORM”
SUBMITTED BY
35-Chavan Khushi Jitendra(2200340449)
1
DEPARTMENT OF COMPUTER TECHNOLOGY
Sanjivani Rural Education Society’s
SANJIVANI K.B.P POLYTECHNIC
KOPARGAON-423603, DIST-AHMEDNAGAR
(2024-2025)
CERTIFICATE
This is to certify that the Project report entitled
2
“EXAM REGISTRATION FORM”
Submitted By
124-Chavan Khushi Jitendra(2100340239)
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
7
FLOWCHART
START
If all fieldyes
filled
If (row
affected>0)
STOP
8
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(nul
l);
l1=new JLabel("EXAM REGISTRATION FORM");
l1.setFont(new Font("Serif", Font.PLAIN, 24));
l1.setBounds(200, 50, 500, 40);
add(l1);
9
l2=new JLabel("Enter Student Name: ");
l2.setFont(new Font("Serif", Font.BOLD, 20));
l2.setBounds(60, 130, 190, 40);
add(l2); // 1st text box t1=new
JTextField(); t1.setBounds(240, 130, 150, 40);
add(t1);
10
add(r1); add(r2);
add(r3);
String[] course={"","A","B","C","D","E","I"};
cb=new JComboBox<>(course);
t2=new JTextField();
t2.setBounds(230, 400, 150, 40);
add(t2);
add(l6);
11
String[] course2={"1 sem","2 sem","3 sem","4 sem","5 sem","6 sem"};
cb2=new JComboBox<>(course2);
cb2.setBounds(60,510,150,40);
add(cb2);
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);
add(l7);
12
b1.addActionListener(this);
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();
13
try {
Class.forName("oracle.jdbc.driver.OracleDriver"); 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
14
OUTPUT
15
REFERENCES
1 .https://www.w3schools.com/sql/sql_create_table.asp
2. https://www.geeksforgeeks.org/introduction-to-java-swing/
16
3. Advanced Java Notes
17