Repository navigation
Expand file tree
/
Copy pathEnterMarks.java
More file actions
122 lines (93 loc) · 3.18 KB
/
Copy pathEnterMarks.java
File metadata and controls
122 lines (93 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* 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 university.management.systems;
/**
*
* @author R.SHANMUKH
*/
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.sql.*;
public class EnterMarks extends JFrame implements ActionListener{
JLabel l1,l2,l3,l4;
JTextField t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11;
JButton b1;
EnterMarks(){
setSize(500,550);
setLocation(400,200);
setLayout(null);
l1 = new JLabel("Enter marks of Student");
l1.setFont(new Font("serif", Font.BOLD, 30));
l1.setBounds(50,0,500,80);
add(l1);
l2 = new JLabel("Enter Roll Number");
l2.setBounds(50,70,200,40);
add(l2);
t1 = new JTextField();
t1.setBounds(180,80,200,20);
add(t1);
l3 = new JLabel("Enter Subject");
l3.setBounds(50,150,200,40);
add(l3);
l4 = new JLabel("Enter Marks");
l4.setBounds(250,150,200,40);
add(l4);
t2 = new JTextField();
t2.setBounds(50,200,200,20);
add(t2);
t3 = new JTextField();
t3.setBounds(250,200,200,20);
add(t3);
t4 = new JTextField();
t4.setBounds(50,230,200,20);
add(t4);
t5 = new JTextField();
t5.setBounds(250,230,200,20);
add(t5);
t6 = new JTextField();
t6.setBounds(50,260,200,20);
add(t6);
t7 = new JTextField();
t7.setBounds(250,260,200,20);
add(t7);
t8 = new JTextField();
t8.setBounds(50,290,200,20);
add(t8);
t9 = new JTextField();
t9.setBounds(250,290,200,20);
add(t9);
t10 = new JTextField();
t10.setBounds(50,320,200,20);
add(t10);
t11 = new JTextField();
t11.setBounds(250,320,200,20);
add(t11);
b1 = new JButton("Submit");
b1.setBounds(50,360,100,30);
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
add(b1);
b1.addActionListener(this);
getContentPane().setBackground(Color.WHITE);
}
public void actionPerformed(ActionEvent ae){
try{
if(ae.getSource() == b1){
connect c1 = new connect();
String s1 = "insert into subject values('"+t1.getText()+"','"+t2.getText()+"','"+t4.getText()+"','"+t6.getText()+"','"+t8.getText()+"','"+t10.getText()+"')";
String s2 = "insert into marks values('"+t1.getText()+"','"+t3.getText()+"','"+t5.getText()+"','"+t7.getText()+"','"+t9.getText()+"','"+t11.getText()+"')";
c1.s.executeUpdate(s1);
c1.s.executeUpdate(s2);
JOptionPane.showMessageDialog(null,"Marks Inserted Successfully");
this.setVisible(false);
}
}catch(Exception e){}
}
public static void main(String[] args){
new EnterMarks().setVisible(true);
}
}