-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.java
More file actions
271 lines (235 loc) · 11.2 KB
/
mainwindow.java
File metadata and controls
271 lines (235 loc) · 11.2 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
package traffic;
import java.sql.Connection;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;
/*
* 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.
*/
/**
*
* @author hp
*/
public class mainwindow extends javax.swing.JFrame {
/**
* Creates new form mainwindow
*/
public mainwindow() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
gui = new javax.swing.JMenu();
snapshot = new javax.swing.JMenuItem();
inputmenu = new javax.swing.JMenu();
inputwindow = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
greport1 = new javax.swing.JMenuItem();
jMenu4 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/traffic/hs.jpg"))); // NOI18N
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 60, 210, 320));
jMenuBar1.setBackground(new java.awt.Color(255, 255, 255));
jMenuBar1.setForeground(new java.awt.Color(204, 0, 204));
jMenuBar1.setToolTipText("");
jMenuBar1.setFont(new java.awt.Font("Algerian", 1, 18)); // NOI18N
jMenuBar1.setMaximumSize(new java.awt.Dimension(808, 32769));
jMenuBar1.setMinimumSize(new java.awt.Dimension(2, 2));
jMenuBar1.setPreferredSize(new java.awt.Dimension(808, 26));
gui.setForeground(new java.awt.Color(51, 51, 255));
gui.setText("Camera View");
gui.setFont(new java.awt.Font("Algerian", 1, 18)); // NOI18N
gui.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
gui.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
gui.setMaximumSize(new java.awt.Dimension(171, 32767));
snapshot.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
snapshot.setText("Snapshot of car");
snapshot.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
snapshotActionPerformed(evt);
}
});
gui.add(snapshot);
jMenuBar1.add(gui);
inputmenu.setForeground(new java.awt.Color(255, 0, 0));
inputmenu.setText("Input");
inputmenu.setFont(new java.awt.Font("Algerian", 1, 18)); // NOI18N
inputmenu.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
inputmenu.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
inputmenu.setMaximumSize(new java.awt.Dimension(100, 32767));
inputmenu.addAncestorListener(new javax.swing.event.AncestorListener() {
public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
}
public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
}
public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
inputmenuAncestorMoved(evt);
}
});
inputmenu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
inputmenuActionPerformed(evt);
}
});
inputwindow.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
inputwindow.setText("Input Window");
inputwindow.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
inputwindowActionPerformed(evt);
}
});
inputmenu.add(inputwindow);
jMenuBar1.add(inputmenu);
jMenu2.setText("Challan Report");
jMenu2.setFont(new java.awt.Font("Algerian", 1, 18)); // NOI18N
jMenu2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jMenu2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jMenu2.setMaximumSize(new java.awt.Dimension(190, 32767));
greport1.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
greport1.setText("Generate Report");
greport1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
greport1ActionPerformed(evt);
}
});
jMenu2.add(greport1);
jMenuBar1.add(jMenu2);
jMenu4.setForeground(new java.awt.Color(255, 102, 0));
jMenu4.setText("Pack Up");
jMenu4.setFont(new java.awt.Font("Algerian", 1, 18)); // NOI18N
jMenu4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jMenu4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jMenu4.setMaximumSize(new java.awt.Dimension(150, 32767));
jMenuItem1.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jMenuItem1.setText("Terminate App");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem1);
jMenuItem2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
jMenuItem2.setText("Shutdown");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem2);
jMenuBar1.add(jMenu4);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>//GEN-END:initComponents
private void inputmenuAncestorMoved(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_inputmenuAncestorMoved
// TODO add your handling code here:
}//GEN-LAST:event_inputmenuAncestorMoved
private void inputmenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inputmenuActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_inputmenuActionPerformed
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
// TODO add your handling code here:
int status=JOptionPane.showConfirmDialog(null, "Do you really want to exit the app");
if (status==0)
System.exit(0) ;
}//GEN-LAST:event_jMenuItem1ActionPerformed
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
// TODO add your handling code here:
Runtime runtime=Runtime.getRuntime() ;
try
{
//wait(10) ;
Process proc=runtime.exec("shutdown -s") ;
}
catch(Exception er)
{}
}//GEN-LAST:event_jMenuItem2ActionPerformed
private void inputwindowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inputwindowActionPerformed
// TODO add your handling code here:
inputclass iref=new inputclass();
iref.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_inputwindowActionPerformed
private void greport1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_greport1ActionPerformed
// TODO add your handling code here:
try
{
String REPORT="C:\\Users\\hp\\Documents\\NetBeansProjects\\hackathon\\src\\traffic\\report1.jrxml";
JasperReport JASP_REP=JasperCompileManager.compileReport(REPORT);
Connection conn=connectionclass.Makeconnection();
JasperPrint JASP_PRINT=JasperFillManager.fillReport(JASP_REP,null,conn);
JasperViewer.viewReport(JASP_PRINT);
}
catch(Exception er)
{
JOptionPane.showMessageDialog(null,er);
}
}//GEN-LAST:event_greport1ActionPerformed
private void snapshotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_snapshotActionPerformed
// TODO add your handling code here:
snapshot sref=new snapshot();
sref.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_snapshotActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(mainwindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(mainwindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(mainwindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(mainwindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new mainwindow().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem greport1;
private javax.swing.JMenu gui;
private javax.swing.JMenu inputmenu;
private javax.swing.JMenuItem inputwindow;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem snapshot;
// End of variables declaration//GEN-END:variables
}