-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExaminationDetails.java
More file actions
130 lines (109 loc) · 4.21 KB
/
Copy pathExaminationDetails.java
File metadata and controls
130 lines (109 loc) · 4.21 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
123
124
125
126
127
128
129
130
/*
* 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 java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import java.sql.*;
import java.awt.event.*;
import net.proteanit.sql.DbUtils;
public class ExaminationDetails extends JFrame implements ActionListener{
private JPanel contentPane;
private JTable table;
private JTextField search;
private JButton b1,b2,b3;
public void Book() {
try {
connect con = new connect();
String sql = "select * from student";
PreparedStatement st = con.c.prepareStatement(sql);
ResultSet rs = st.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
rs.close();
st.close();
con.c.close();
} catch (Exception e) {}
}
public ExaminationDetails() {
setBounds(350, 200, 930, 475);
contentPane = new JPanel();
contentPane.setBackground(Color.WHITE);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(79, 133, 1080, 282);
contentPane.add(scrollPane);
table = new JTable();
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
int row = table.getSelectedRow();
search.setText(table.getModel().getValueAt(row, 10).toString());
}
});
table.setBackground(new Color(240, 248, 255));
table.setForeground(Color.DARK_GRAY);
table.setFont(new Font("Trebuchet MS", Font.BOLD, 16));
scrollPane.setViewportView(table);
b1 = new JButton("Result");
b1.addActionListener(this);
b1.setBorder(new LineBorder(new Color(255, 20, 147), 2, true));
b1.setForeground(new Color(199, 21, 133));
b1.setFont(new Font("Trebuchet MS", Font.BOLD, 18));
b1.setBounds(564, 89, 138, 33);
contentPane.add(b1);
JLabel l1 = new JLabel("Check Result");
l1.setForeground(new Color(107, 142, 35));
l1.setFont(new Font("Trebuchet MS", Font.BOLD | Font.ITALIC, 30));
l1.setBounds(300, 15, 400, 47);
contentPane.add(l1);
search = new JTextField();
search.setBackground(new Color(255, 240, 245));
search.setBorder(new LineBorder(new Color(255, 105, 180), 2, true));
search.setForeground(new Color(47, 79, 79));
search.setFont(new Font("Trebuchet MS", Font.BOLD | Font.ITALIC, 17));
search.setBounds(189, 89, 357, 33);
contentPane.add(search);
search.setColumns(10);
JLabel l3 = new JLabel("Back");
l3.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
setVisible(false);
}
});
l3.setForeground(Color.GRAY);
l3.setFont(new Font("Trebuchet MS", Font.BOLD, 18));
l3.setBounds(97, 89, 72, 33);
contentPane.add(l3);
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(new LineBorder(new Color(0, 128, 128), 3, true), "Book-Details",
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 128, 0)));
panel.setBounds(67, 54, 1100, 368);
contentPane.add(panel);
panel.setBackground(Color.WHITE);
Book();
setSize(1200,500);
}
public void actionPerformed(ActionEvent ae){
try{
connect con = new connect();
if(ae.getSource() == b1){
new Marks(search.getText()).setVisible(true);
this.setVisible(false);
};
}
catch(Exception e){}
}
public static void main(String[] args){
new ExaminationDetails().setVisible(true);
}
}