-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainDialog.java
More file actions
1020 lines (885 loc) · 46.9 KB
/
mainDialog.java
File metadata and controls
1020 lines (885 loc) · 46.9 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package footprint;
//import library.database.DatabaseHandler;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import library.database.DatabaseHandler;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.RowSorter;
import javax.swing.SortOrder;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
/**
*
* @author you1-
*/
public class mainDialog extends javax.swing.JFrame {
/**
* Creates new form mainDialog
*/
public mainDialog() {
initComponents();
namesP = pickNames();
dispData();
monthlyfpe();
//super.processWindowEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
// if(new WindowEvent(this, WindowEvent.WINDOW_CLOSING).getID() == WindowEvent.WINDOW_CLOSING) {
// shutdownDB();
// System.out.println("Hbess lmr9a");
// System.exit(0);
// }
}
/**
* 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() {
jPanel1 = new javax.swing.JPanel();
title = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
dashB_Btn = new javax.swing.JLabel();
ManageP_Btn = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
jTable3 = new javax.swing.JTable();
jLabel4 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
DispLineLength = new javax.swing.JLabel();
dispNumShift = new javax.swing.JLabel();
ProjName = new javax.swing.JLabel();
mainView = new javax.swing.JPanel();
ManageP_View = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel6 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jTable2 = new javax.swing.JTable();
jLabel13 = new javax.swing.JLabel();
DashB_View = new javax.swing.JPanel();
lineChartPanel = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setSize(new java.awt.Dimension(1370, 717));
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(5, 46, 68));
title.setBackground(new java.awt.Color(255, 255, 255));
title.setFont(new java.awt.Font("Impact", 0, 36)); // NOI18N
title.setForeground(new java.awt.Color(244, 246, 243));
title.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
title.setText("Shop Floor Space Management");
jLabel12.setFont(new java.awt.Font("Breezi Icon Set", 0, 14)); // NOI18N
jLabel12.setForeground(new java.awt.Color(0, 179, 165));
jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/library/images/icons8-broom-30.png"))); // NOI18N
jLabel12.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jLabel12.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel12MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLabel12MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLabel12MouseExited(evt);
}
});
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/library/images/LOGO_ALSTOM_SAGUEZ_1_30.jpg"))); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 369, Short.MAX_VALUE)
.addComponent(title)
.addGap(302, 302, 302)
.addComponent(jLabel12)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel12))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(title, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1370, 110));
jPanel2.setBackground(new java.awt.Color(5, 46, 68));
dashB_Btn.setBackground(new java.awt.Color(7, 34, 47));
dashB_Btn.setFont(new java.awt.Font("Impact", 0, 18)); // NOI18N
dashB_Btn.setForeground(new java.awt.Color(132, 146, 160));
dashB_Btn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
dashB_Btn.setText("Dashboard");
dashB_Btn.setToolTipText("");
dashB_Btn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
dashB_Btn.setOpaque(true);
dashB_Btn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
dashB_BtnMouseClicked(evt);
}
});
ManageP_Btn.setBackground(new java.awt.Color(255, 255, 255));
ManageP_Btn.setFont(new java.awt.Font("Impact", 0, 18)); // NOI18N
ManageP_Btn.setForeground(new java.awt.Color(132, 146, 160));
ManageP_Btn.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
ManageP_Btn.setText("Manage Projects");
ManageP_Btn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
ManageP_Btn.setOpaque(true);
ManageP_Btn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ManageP_BtnMouseClicked(evt);
}
});
jTable3.setBackground(new java.awt.Color(5, 46, 68));
jTable3.setFont(new java.awt.Font("Serif", 0, 14)); // NOI18N
jTable3.setForeground(new java.awt.Color(255, 255, 255));
jTable3.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Month", "N° of Vertical lines"
}
));
jTable3.setGridColor(new java.awt.Color(255, 255, 255));
jTable3.setRowHeight(20);
jTable3.setShowGrid(true);
jScrollPane3.setViewportView(jTable3);
if (jTable3.getColumnModel().getColumnCount() > 0) {
jTable3.getColumnModel().getColumn(0).setPreferredWidth(150);
}
jLabel4.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Line lenght :");
jLabel9.setFont(new java.awt.Font("SansSerif", 0, 14)); // NOI18N
jLabel9.setForeground(new java.awt.Color(255, 255, 255));
jLabel9.setText("N° of Shifts :");
DispLineLength.setFont(new java.awt.Font("Serif", 0, 14)); // NOI18N
DispLineLength.setForeground(new java.awt.Color(255, 255, 255));
dispNumShift.setFont(new java.awt.Font("Serif", 0, 14)); // NOI18N
dispNumShift.setForeground(new java.awt.Color(255, 255, 255));
ProjName.setFont(new java.awt.Font("Bebas Neue", 0, 18)); // NOI18N
ProjName.setForeground(new java.awt.Color(255, 255, 255));
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(dashB_Btn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ManageP_Btn, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(ProjName, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(dispNumShift, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE)
.addComponent(DispLineLength, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(dashB_Btn, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ManageP_Btn, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(16, 16, 16)
.addComponent(ProjName, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(DispLineLength, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(dispNumShift, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(151, Short.MAX_VALUE))
);
jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {ManageP_Btn, dashB_Btn});
getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 110, 230, 630));
mainView.setBackground(new java.awt.Color(255, 255, 255));
mainView.setLayout(new java.awt.CardLayout());
ManageP_View.setBackground(new java.awt.Color(255, 255, 255));
jTable1.setFont(new java.awt.Font("Serif", 0, 14)); // NOI18N
jTable1.setForeground(new java.awt.Color(27, 48, 61));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Project"
}
));
jTable1.setGridColor(new java.awt.Color(169, 178, 186));
jTable1.setRowHeight(20);
jTable1.setRowMargin(3);
jTable1.setSelectionBackground(new java.awt.Color(186, 226, 224));
jTable1.setSelectionForeground(java.awt.Color.black);
jTable1.setShowGrid(true);
jScrollPane1.setViewportView(jTable1);
if (jTable1.getColumnModel().getColumnCount() > 0) {
jTable1.getColumnModel().getColumn(0).setPreferredWidth(200);
}
jLabel6.setFont(new java.awt.Font("Breezi Icon Set", 0, 30)); // NOI18N
jLabel6.setForeground(new java.awt.Color(0, 179, 165));
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/library/images/icons8-refresh-30.png"))); // NOI18N
jLabel6.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jLabel6.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel6MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLabel6MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLabel6MouseExited(evt);
}
});
jLabel2.setFont(new java.awt.Font("Breezi Icon Set", 0, 30)); // NOI18N
jLabel2.setForeground(new java.awt.Color(0, 179, 165));
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/library/images/icons8-info-30.png"))); // NOI18N
jLabel2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel2MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLabel2MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLabel2MouseExited(evt);
}
});
jLabel10.setFont(new java.awt.Font("Breezi Icon Set", 0, 30)); // NOI18N
jLabel10.setForeground(new java.awt.Color(0, 179, 165));
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/library/images/icons8-delete-30.png"))); // NOI18N
jLabel10.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jLabel10.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel10MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLabel10MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLabel10MouseExited(evt);
}
});
jTable2.setFont(new java.awt.Font("Serif", 0, 14)); // NOI18N
jTable2.setForeground(new java.awt.Color(27, 48, 61));
jTable2.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
""
}
));
jTable2.setGridColor(new java.awt.Color(169, 178, 186));
jTable2.setRowHeight(20);
jTable2.setRowMargin(3);
jTable2.setSelectionBackground(new java.awt.Color(186, 226, 224));
jTable2.setSelectionForeground(new java.awt.Color(27, 48, 61));
jTable2.setShowGrid(true);
jTable2.setShowVerticalLines(false);
jTable2.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
jTable2PropertyChange(evt);
}
});
jScrollPane2.setViewportView(jTable2);
if (jTable2.getColumnModel().getColumnCount() > 0) {
jTable2.getColumnModel().getColumn(0).setPreferredWidth(200);
}
jLabel13.setBackground(new java.awt.Color(255, 255, 255));
jLabel13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/library/images/addProjectIcon.png"))); // NOI18N
jLabel13.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jLabel13.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel13MouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
jLabel13MouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jLabel13MouseExited(evt);
}
});
javax.swing.GroupLayout ManageP_ViewLayout = new javax.swing.GroupLayout(ManageP_View);
ManageP_View.setLayout(ManageP_ViewLayout);
ManageP_ViewLayout.setHorizontalGroup(
ManageP_ViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(ManageP_ViewLayout.createSequentialGroup()
.addContainerGap()
.addGroup(ManageP_ViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ManageP_ViewLayout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(jLabel13)
.addGap(32, 32, 32)
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(jLabel10)
.addGap(18, 18, 18)
.addComponent(jLabel6)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(ManageP_ViewLayout.createSequentialGroup()
.addGroup(ManageP_ViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 1116, Short.MAX_VALUE)
.addComponent(jScrollPane1))
.addContainerGap())))
);
ManageP_ViewLayout.setVerticalGroup(
ManageP_ViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(ManageP_ViewLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(ManageP_ViewLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 399, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(41, 41, 41))
);
mainView.add(ManageP_View, "ManageCard");
DashB_View.setBackground(new java.awt.Color(255, 255, 255));
DashB_View.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
lineChartPanel.setBackground(new java.awt.Color(255, 255, 255));
lineChartPanel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(5, 46, 68), 1, true));
lineChartPanel.setLayout(new java.awt.BorderLayout());
DashB_View.add(lineChartPanel, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 60, 690, 450));
mainView.add(DashB_View, "DashCard");
DashB_View.getAccessibleContext().setAccessibleName("");
getContentPane().add(mainView, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 110, 1140, 610));
pack();
}// </editor-fold>//GEN-END:initComponents
private void jLabel6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseClicked
dispData();
monthlyfpe();
}//GEN-LAST:event_jLabel6MouseClicked
private void jLabel12MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MouseClicked
int cancel = JOptionPane.showInternalConfirmDialog(null, "Are you sure you want to delete all the data?", "Data Cleaning Confirmation", 0);
if(cancel == JOptionPane.YES_OPTION){
DefaultTableModel model;
model = (DefaultTableModel) jTable1.getModel();
model.getDataVector().removeAllElements();
model.fireTableDataChanged();
namesP.clear();
String qu1 = "DELETE FROM PROJECTS";
ResultSet rs = databaseHandler.execQuery(qu1);
if(databaseHandler.execAction(qu1)){
JOptionPane.showInternalMessageDialog(null, "Success Projects cleaned");
dispData();
monthlyfpe();
}
else{
JOptionPane.showMessageDialog(null, "An Error has occured", "Database Error", JOptionPane.ERROR_MESSAGE);
}
String qu2 = "DELETE FROM PH";
ResultSet rs1 = databaseHandler.execQuery(qu2);
if(databaseHandler.execAction(qu2)){
JOptionPane.showInternalMessageDialog(null, "Success PHs cleaned");
dispData();
monthlyfpe();
}
else{
JOptionPane.showMessageDialog(null, "An Error has occured", "Database Error", JOptionPane.ERROR_MESSAGE);
}
}
}//GEN-LAST:event_jLabel12MouseClicked
private void jLabel10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel10MouseClicked
DefaultTableModel model;
model = (DefaultTableModel) jTable1.getModel();
int i = jTable1.getSelectedRow();
if (i != -1) {
int Delete = JOptionPane.showInternalConfirmDialog(null, "Are you sure you want to delete the project?", "Delete Confirmation", 0);
if (Delete == JOptionPane.YES_OPTION) {
String nameP = (String) model.getValueAt(i, 0);
String qu = "DELETE FROM PROJECTS WHERE name='" + nameP + "'";
databaseHandler.execQuery(qu);
boolean bin = namesP.remove(nameP);
model.removeRow(i);
if (databaseHandler.execAction(qu) && bin) {
JOptionPane.showInternalMessageDialog(null, "Project successfully deleted");
dispData();
monthlyfpe();
} else {
JOptionPane.showMessageDialog(null, "An Error has occured", "Database Error", JOptionPane.ERROR_MESSAGE);
}
}
} else {
JOptionPane.showInternalMessageDialog(null, "Select a Project to delete");
}
}//GEN-LAST:event_jLabel10MouseClicked
private void jLabel13MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MouseClicked
detailsEntry obj = new detailsEntry();
obj.setVisible(true);
}//GEN-LAST:event_jLabel13MouseClicked
private void dashB_BtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_dashB_BtnMouseClicked
setbtnColor(dashB_Btn);
resetbtnColor(ManageP_Btn);
CardLayout card = (CardLayout)mainView.getLayout();
card.show(mainView, "DashCard");
}//GEN-LAST:event_dashB_BtnMouseClicked
private void ManageP_BtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ManageP_BtnMouseClicked
setbtnColor(ManageP_Btn);
resetbtnColor(dashB_Btn);
CardLayout card = (CardLayout)mainView.getLayout();
card.show(mainView, "ManageCard");
}//GEN-LAST:event_ManageP_BtnMouseClicked
private void jLabel13MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MouseEntered
setbtnColor2(jLabel13);
}//GEN-LAST:event_jLabel13MouseEntered
private void jLabel13MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel13MouseExited
resetbtnColor2(jLabel13);
}//GEN-LAST:event_jLabel13MouseExited
private void jLabel10MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel10MouseEntered
jLabel10.setForeground(new Color(0,141,160));
}//GEN-LAST:event_jLabel10MouseEntered
private void jLabel10MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel10MouseExited
jLabel10.setForeground(new Color(0,179,165));
}//GEN-LAST:event_jLabel10MouseExited
private void jLabel2MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseEntered
jLabel2.setForeground(new Color(0,141,160));
}//GEN-LAST:event_jLabel2MouseEntered
private void jLabel2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseExited
jLabel2.setForeground(new Color(0,179,165));
}//GEN-LAST:event_jLabel2MouseExited
private void jLabel6MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseEntered
jLabel6.setForeground(new Color(0,141,160));
}//GEN-LAST:event_jLabel6MouseEntered
private void jLabel6MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseExited
jLabel6.setForeground(new Color(0,179,165));
}//GEN-LAST:event_jLabel6MouseExited
private void jLabel12MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MouseEntered
jLabel12.setForeground(new Color(0,141,160));
}//GEN-LAST:event_jLabel12MouseEntered
private void jLabel12MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MouseExited
jLabel12.setForeground(new Color(0,179,165));
}//GEN-LAST:event_jLabel12MouseExited
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked
DefaultTableModel model1;
DefaultTableModel model3;
DateFormat dfD = new SimpleDateFormat("MMMMM yyyy");
model1 = (DefaultTableModel) jTable1.getModel();
model3 = (DefaultTableModel) jTable3.getModel();
model3.getDataVector().removeAllElements();
model3.fireTableDataChanged();
int i = jTable1.getSelectedRow();
if(i!=-1){
String nameP = (String) model1.getValueAt(i, 0);
ProjName.setText(nameP);
String qu1 = "SELECT month,numOfVerticalLines\n "
+ "FROM PROJECTS\n"
+ "WHERE name = '" + nameP + "'\n"
+ "ORDER BY month";
ResultSet rs = databaseHandler.execQuery(qu1);
try {
while(rs.next()){
Date date = rs.getDate("month");
model3.addRow(new Object[]{dfD.format(date),rs.getInt("numOfVerticalLines")});
}
} catch (SQLException ex) {
Logger.getLogger(mainDialog.class.getName()).log(Level.SEVERE, null, ex);
}
String qu2 = "SELECT name,numShifts,Linelength\n"
+ "FROM PROJECTS\n"
// + "GROUP BY name\n"
+ "WHERE name = '"+ nameP + "'";
ResultSet rs1 = databaseHandler.execQuery(qu2);
try {
while(rs1.next())
{
DispLineLength.setText(rs1.getString("Linelength"));
dispNumShift.setText(rs1.getString("numShifts"));
}
} catch (SQLException ex) {
Logger.getLogger(mainDialog.class.getName()).log(Level.SEVERE, null, ex);
}
}
}//GEN-LAST:event_jLabel2MouseClicked
private void jTable2PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTable2PropertyChange
DecimalFormat df = new DecimalFormat("0.00");
DefaultTableModel model2;
model2 = (DefaultTableModel) jTable2.getModel();
for(int i=0;i<model2.getColumnCount()-1;i++){
double value = Double.valueOf(model2.getValueAt(1, i+1).toString())-Double.valueOf(model2.getValueAt(0, i+1).toString());
model2.setValueAt(df.format(value), 2, i+1);
}
monthlyfpe();
}//GEN-LAST:event_jTable2PropertyChange
/**
* @param lb
* @param args the command line arguments
*/
public void setbtnColor(JLabel lb){
lb.setBackground(new Color(255,255,255));
}
public void resetbtnColor(JLabel lb){
lb.setBackground(new Color(7,34,47));
}
public void setbtnColor2(JLabel lb){
lb.setBackground(new Color(0,141,160));
}
public void resetbtnColor2(JLabel lb){
lb.setBackground(new Color(8,178,164));
}
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 ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(mainDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(mainDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(mainDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(mainDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
new mainDialog().setVisible(true);
} catch (Exception ex) {
Logger.getLogger(mainDialog.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
}
@SuppressWarnings("unchecked")
static void dispData() {
int a=0;
//fonction pour avoir les projets affichés dans l'ordre alphabetique
sortNames();
//afficher que deux chiffres apres la virgule
DecimalFormat df = new DecimalFormat("0.00");
//format d'affichage de la date
DateFormat dfD = new SimpleDateFormat("MMM-yyyy");
//avoir les modeles des deux tableaux
DefaultTableModel model;
DefaultTableModel model2;
model = (DefaultTableModel) jTable1.getModel();
model2 = (DefaultTableModel) jTable2.getModel();
//initialiser avec une colonne
model2.setColumnCount(1);
model.setColumnCount(1);
//reinitialisation
model.getDataVector().removeAllElements();
model2.getDataVector().removeAllElements();
model.fireTableDataChanged();
model2.fireTableDataChanged();
//requete SQL pour avoir le total de la surface occupee par les projets
//sur chaque mois
String quz = "SELECT month,SUM(total_surface_needed) AS totalSN\n "
+ "FROM PROJECTS\n"
+ "GROUP BY month\n"
+ "ORDER BY month";
ResultSet rs1 = databaseHandler.execQuery(quz);
try {
Vector v1 = new Vector();
v1.add("Total Surface Needed");
//recuperation des donnees
while (rs1.next()) {
Date date = rs1.getDate("month");
model2.addColumn(dfD.format(date));
model.addColumn(dfD.format(date));
v1.add(df.format(rs1.getDouble("totalSN")));
a++;
}
model2.addRow(v1);
jTable2.getColumnModel().getColumn(0).setPreferredWidth(200);
jTable1.getColumnModel().getColumn(0).setPreferredWidth(200);
}
catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error:" + ex.getMessage(), "Error Occured", JOptionPane.ERROR_MESSAGE);
}
Vector v2 = new Vector();
v2.add("Total Surface Available ");
for(int i=0;i<a;i++){
v2.add(1100);
}
model2.addRow(v2);
//pour faire la difference
Vector v3 = new Vector();
v3.add("Area Balance");
for(int i=0;i<a;i++){
v3.add(df.format(Double.valueOf(model2.getValueAt(1, i+1).toString())
-Double.valueOf(model2.getValueAt(0, i+1).toString()))) ;
}
model2.addRow(v3);
//importer et afficher chaque projet a partir d'une recherche avec son nom
for (int i = 0; i < namesP.size(); i++) {
try {
int d = 0;
//DatabaseHandler databaseHandler1 = new DatabaseHandler();
String qu1 = "SELECT month,total_surface_needed\n "
+ "FROM PROJECTS\n"
+ "WHERE name = '" + namesP.get(i) + "'\n"
+ "ORDER BY month";
ResultSet rs = databaseHandler.execQuery(qu1);
Vector v = new Vector();
while (rs.next()) {
if (d == 0) {
v.add(namesP.get(i));
d++;
}
v.add(df.format(rs.getDouble("total_surface_needed")));
}
model.addRow(v);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error:" + ex.getMessage(), "Error Occured", JOptionPane.ERROR_MESSAGE);
}
}
}
static void checkDataP(){
//DatabaseHandler databaseHandler = new DatabaseHandler();
System.out.print("id\t name\t type\t numShifts\t hoursPerMonth\t layUpRatio\tLinelength\tLine_Config\tUtilized_sides\tcharge\tcapacity\tnumOfVerticalLines\tsupportLength\tNumFinTab\tnumPackStat\tnumKitRack\tnumWRack\tnumKanRack\tnumMecTable\tsurSup2m\tsurFinTab\tsurPackStat\tsurKitRack\tsurWRack\tsurKanRack\tsurAsseyBH\tsurMecTable\tmonth\tProductivity\tBacklog\tnumOfSupp_R\tNumFinTab_R\tnumPackStat_R\tnumKitRack_R\tnumWRack_R\tnumKanRack_R\tnumMecTable_R\tnumAsseyBH_R\tsurSup2m_R\tsurFinTab_R\tsurPackStat_R\tsurKitRack_R\tsurWRack_R\tsurKanRack_R\tsurAsseyBH_R\tsurMecTable_R\ttotal_surface_needed\n");
String qu1 = "SELECT * FROM PROJECTS";
ResultSet rs = databaseHandler.execQuery(qu1);
try{
while(rs.next()){
System.out.print(rs.getInt("id")+"\t");
System.out.print(rs.getString("name")+"\t");
System.out.print(rs.getString("type")+"\t");
System.out.print(rs.getInt("numShifts")+"\t");
System.out.print(rs.getDouble("hoursPerMonth")+"\t");
System.out.print(rs.getDouble("layUpRatio")+"\t");
System.out.print(rs.getInt("Linelength")+"\t");
System.out.print(rs.getString("Line_Config")+"\t");
System.out.print(rs.getInt("Utilized_sides")+"\t");
System.out.print(rs.getDouble("charge")+"\t");
System.out.print(rs.getDouble("capacity")+"\t");
System.out.print(rs.getDouble("numOfVerticalLines")+"\t");
System.out.print(rs.getDouble("supportLength")+"\t");
System.out.print(rs.getDouble("NumFinTab")+"\t");
System.out.print(rs.getDouble("numPackStat")+"\t");
System.out.print(rs.getDouble("numKitRack")+"\t");
System.out.print(rs.getDouble("numWRack")+"\t");
System.out.print(rs.getDouble("numKanRack")+"\t");
System.out.print(rs.getDouble("numMecTable")+"\t");
System.out.print(rs.getDouble("surSup2m")+"\t");
System.out.print(rs.getDouble("surFinTab")+"\t");
System.out.print(rs.getDouble("surPackStat")+"\t");
System.out.print(rs.getDouble("surKitRack")+"\t");
System.out.print(rs.getDouble("surWRack")+"\t");
System.out.print(rs.getDouble("surKanRack")+"\t");
System.out.print(rs.getDouble("surAsseyBH")+"\t");
System.out.print(rs.getDouble("surMecTable")+"\t");
System.out.print(rs.getDate("month")+"\t");
System.out.print(rs.getDouble("Productivity")+"\t");
System.out.print(rs.getDouble("Backlog")+"\t");
System.out.print(rs.getDouble("numOfSupp_R")+"\t");
System.out.print(rs.getDouble("NumFinTab_R")+"\t");
System.out.print(rs.getDouble("numPackStat_R")+"\t");
System.out.print(rs.getDouble("numKitRack_R")+"\t");
System.out.print(rs.getDouble("numWRack_R")+"\t");
System.out.print(rs.getDouble("numKanRack_R")+"\t");
System.out.print(rs.getDouble("numMecTable_R")+"\t");
System.out.print(rs.getDouble("numAsseyBH_R")+"\t");
System.out.print(rs.getDouble("surSup2m_R")+"\t");
System.out.print(rs.getDouble("surFinTab_R")+"\t");
System.out.print(rs.getDouble("surPackStat_R")+"\t");
System.out.print(rs.getDouble("surKitRack_R")+"\t");
System.out.print(rs.getDouble("surWRack_R")+"\t");
System.out.print(rs.getDouble("surKanRack_R")+"\t");
System.out.print(rs.getDouble("surAsseyBH_R")+"\t");
System.out.print(rs.getDouble("surMecTable_R")+"\t");
System.out.print(rs.getDouble("total_surface_needed")+"\n");
}
}
catch(SQLException ex){
JOptionPane.showMessageDialog(null, "Error:" + ex.getMessage(), "Error Occured", JOptionPane.ERROR_MESSAGE);
}
}
class projectData{
private String name;
private double surface_needed;
public projectData() {
this.name = "";
this.surface_needed = 0;
}
public String getName() {
return name;
}
public double getSurface_needed() {
return surface_needed;
}
public void setName(String name) {
this.name = name;
}
public void setSurface_needed(double surface_needed) {
this.surface_needed = surface_needed;
}
}
static void monthlyfpe(){
DateFormat dfD = new SimpleDateFormat("MM/yy");
String series1 = "Total Surface Needed";
String series2 = "Total Surface Available";
DefaultTableModel model2;
model2 = (DefaultTableModel) jTable2.getModel();
ArrayList<String> date_ = new ArrayList<>();
dataset.clear();
String qu = "SELECT month,SUM(total_surface_needed) AS sumTS\n "
+ "FROM PROJECTS\n"
+ "GROUP BY month\n"
+ "ORDER BY month";
ResultSet rs = databaseHandler.execQuery(qu);
try {
while(rs.next()){
Date date = rs.getDate("month");
dataset.addValue(rs.getDouble("sumTS"), series1,(String) dfD.format(date) );
date_.add((String) dfD.format(date));
}
//y-axis,to which series,x-axis
} catch (SQLException ex) {
Logger.getLogger(mainDialog.class.getName()).log(Level.SEVERE, null, ex);
}
for(int i=0;i<model2.getColumnCount()-1;i++){
dataset.addValue(Double.valueOf(model2.getValueAt(1, i+1).toString()),series2,date_.get(i));
}
JFreeChart chart = ChartFactory.createLineChart(
"Monthly FPE 2 Shift", // Chart title
"Month", // X-Axis Label
"Surface", // Y-Axis Label
dataset,
PlotOrientation.VERTICAL,
true,true,false);
chart.setBackgroundPaint((new Color(0xFFFFFF)));
ChartPanel chartPanel = new ChartPanel( chart );
Plot plot = chart.getPlot();
plot.setForegroundAlpha(0.5F);
plot.setOutlinePaint((new Color(0x052E44)));
lineChartPanel.add(chartPanel,BorderLayout.CENTER);
lineChartPanel.validate();
}
private static DatabaseHandler databaseHandler = new DatabaseHandler();
public static ArrayList<String> namesP = new ArrayList<>();
private static DefaultCategoryDataset dataset = new DefaultCategoryDataset();
static void sortNames(){
Collections.sort(namesP, new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return s1.compareToIgnoreCase(s2);
}
});
}
public static ArrayList<String> pickNames(){
//DatabaseHandler databaseHandler = new DatabaseHandler();
ArrayList<String> names = new ArrayList<>();
String qu1 = "SELECT name FROM PROJECTS";
ResultSet rs = databaseHandler.execQuery(qu1);
try {
String c = "";
while (rs.next()) {
if (!c.equals(rs.getString("name"))) {
names.add(rs.getString("name"));
//System.out.println(rs.getString("name"));
}
c=rs.getString("name");
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Error:" + ex.getMessage(), "Error Occured", JOptionPane.ERROR_MESSAGE);
}
return names;
}
// protected void processWindowEvent(WindowEvent e) {
// super.processWindowEvent(e);
// if(e.getID() == WindowEvent.WINDOW_CLOSING) {
// shutdownDB();
// System.out.println("Hbess lmr9a");
// System.exit(0);
// }
// }
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel DashB_View;
private javax.swing.JLabel DispLineLength;
private javax.swing.JLabel ManageP_Btn;
private javax.swing.JPanel ManageP_View;
private javax.swing.JLabel ProjName;
private javax.swing.JLabel dashB_Btn;
private javax.swing.JLabel dispNumShift;
private javax.swing.JLabel jLabel1;