-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReclamation.java
More file actions
160 lines (119 loc) · 4.05 KB
/
Copy pathReclamation.java
File metadata and controls
160 lines (119 loc) · 4.05 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.border.CompoundBorder;
import java.awt.Component;
import java.awt.Cursor;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.table.AbstractTableModel;
import javax.swing.JScrollPane;
import net.proteanit.sql.DbUtils;
import java.awt.Button;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;
import java.awt.Color;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class Reclamation { // interface de gestion des reclamations
private JFrame frame;
private JTable table_1;
private String[] column_headers={"abc","abc"};
private String [] column={"abc"};
private JTable table;
Connection con=connect.getConnection();//connection to data base
PreparedStatement prepared=null;
ResultSet resultat=null;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Reclamation window = new Reclamation();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Reclamation() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("Gestion de réclamations");
frame.setBounds(100, 100, 770, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.setResizable(false);
JButton chargerLesReclamation = new JButton("charger les reclamation");//bouton qui actualise et rafraichie la liste de reclamations
chargerLesReclamation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
updateTable();
}
});
chargerLesReclamation.setFont(new Font("Tahoma", Font.ITALIC, 15));
chargerLesReclamation.setBounds(575, 63, 190, 44);
frame.getContentPane().add(chargerLesReclamation);
JButton notifie = new JButton("Notifier Enseignant");
notifie.addActionListener(new ActionListener() {// notifier l'enseinant concerné qu'il a une nouvelle reclamation
public void actionPerformed(ActionEvent e) {
// mettre a jour la reclamation son champs 'notif' à oui
String sql=("update reclamation set notif ='oui' where etat='non';");
try {
prepared=con.prepareStatement(sql);
prepared.execute();
JOptionPane.showMessageDialog(null," Notifie avec Succes");
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}});
notifie.setFont(new Font("Tahoma", Font.ITALIC, 15));
notifie.setBounds(0, 63, 190, 44);
frame.getContentPane().add(notifie);
JButton btnRetoutner = new JButton("Retourner");
btnRetoutner.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Accueil c=new Accueil();
c.setVisible(true);frame.dispose();
}
});
btnRetoutner.setForeground(Color.RED);
btnRetoutner.setFont(new Font("Tahoma", Font.BOLD, 13));
btnRetoutner.setBounds(287, 0, 196, 44);
frame.getContentPane().add(btnRetoutner);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(0, 106, 765, 333);
frame.getContentPane().add(scrollPane);
table = new JTable();
scrollPane.setViewportView(table);
}
//methode qui actualise et rafraichie la liste de reclamations
public void updateTable()
{
try
{
String sql="select mat As Matricule, module as Module,etat As Repondue_ou_non ,notif as Notifiée_ou_non from reclamation where etat='non' and notif='non' ;";
prepared =con.prepareStatement(sql);
resultat=prepared.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(resultat));
}catch(SQLException e) {
e.printStackTrace();
}
}
}