-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transaksi.java
800 lines (686 loc) · 41.5 KB
/
Transaksi.java
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
import Database.KoneksiDatabase;
import Database.ResultSetTable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JOptionPane;
public class Form_Transaksi extends javax.swing.JInternalFrame {
ResultSet rs;
KoneksiDatabase con;
static String nama;
static String nik;
static String alamat;
static String tlp;
static String email;
String status1;
/**
* Creates new form Form_Transaksi
*/
public Form_Transaksi(String nama, String nik, String alamat, String tlp, String email) {
con = new KoneksiDatabase(new Database.Parameter().HOST_DB, new Database.Parameter().USERNAME_DB, new Database.Parameter().PASSWORD_DB);
initComponents();
lblNama.setText(nama);
lblNik.setText(nik);
lbl_alamat.setText(alamat);
lbl_tlp.setText(tlp);
lbl_email.setText(email);
loadMobil();
loadTabel();
}
Form_Transaksi(String nama, String alamat, String tlp, String email) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
/**
* 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">
private void initComponents() {
panelGlass1 = new usu.widget.glass.PanelGlass();
jLabel2 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jLabel23 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel24 = new javax.swing.JLabel();
jLabel25 = new javax.swing.JLabel();
lblNama = new javax.swing.JLabel();
lbl_alamat = new javax.swing.JLabel();
lbl_tlp = new javax.swing.JLabel();
lbl_email = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
lblNik = new javax.swing.JLabel();
panelGlass3 = new usu.widget.glass.PanelGlass();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel32 = new javax.swing.JLabel();
jLabel37 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
txt_lama = new javax.swing.JTextField();
txt_total = new javax.swing.JLabel();
btn_Refresh__addItem = new usu.widget.ButtonGlass();
jLabel40 = new javax.swing.JLabel();
jLabel41 = new javax.swing.JLabel();
jDateChooser1 = new com.toedter.calendar.JDateChooser();
jDateChooser2 = new com.toedter.calendar.JDateChooser();
panelGlass2 = new usu.widget.glass.PanelGlass();
boxnopol = new javax.swing.JComboBox();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel27 = new javax.swing.JLabel();
jLabel29 = new javax.swing.JLabel();
jLabel30 = new javax.swing.JLabel();
jLabel31 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jLabel33 = new javax.swing.JLabel();
jLabel34 = new javax.swing.JLabel();
lbl_merek = new javax.swing.JLabel();
lbl_tipe = new javax.swing.JLabel();
lbl_tahun = new javax.swing.JLabel();
lbl_harga = new javax.swing.JLabel();
jLabel36 = new javax.swing.JLabel();
lbl_status = new javax.swing.JLabel();
jLabel38 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
table_transaksi = new javax.swing.JTable();
btn_Refresh__addItem1 = new usu.widget.ButtonGlass();
btn_create_addItem = new usu.widget.ButtonGlass();
jLabel6 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
panelGlass1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel2.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Data Peminjam");
panelGlass1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 11, -1, -1));
jLabel4.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText("Nama");
panelGlass1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, 48, -1));
jLabel5.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel5.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setText("Alamat");
panelGlass1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, 48, -1));
jLabel22.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel22.setForeground(new java.awt.Color(255, 255, 255));
jLabel22.setText("No. Tlp");
panelGlass1.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 141, -1, -1));
jLabel23.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel23.setForeground(new java.awt.Color(255, 255, 255));
jLabel23.setText(":");
panelGlass1.add(jLabel23, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 140, 16, -1));
jLabel10.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel10.setForeground(new java.awt.Color(255, 255, 255));
jLabel10.setText(":");
panelGlass1.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 110, 14, -1));
jLabel11.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel11.setForeground(new java.awt.Color(255, 255, 255));
jLabel11.setText(":");
panelGlass1.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 80, 14, -1));
jLabel24.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel24.setForeground(new java.awt.Color(255, 255, 255));
jLabel24.setText("Email");
panelGlass1.add(jLabel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 170, -1, -1));
jLabel25.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel25.setForeground(new java.awt.Color(255, 255, 255));
jLabel25.setText(":");
panelGlass1.add(jLabel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 170, 16, -1));
lblNama.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lblNama.setForeground(new java.awt.Color(255, 255, 255));
lblNama.setText("Nama");
panelGlass1.add(lblNama, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 50, 79, -1));
lbl_alamat.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lbl_alamat.setForeground(new java.awt.Color(255, 255, 255));
lbl_alamat.setText("Alamat");
panelGlass1.add(lbl_alamat, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 90, 60, 47));
lbl_tlp.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lbl_tlp.setForeground(new java.awt.Color(255, 255, 255));
lbl_tlp.setText("No. Tlp");
panelGlass1.add(lbl_tlp, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 142, 100, -1));
lbl_email.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lbl_email.setForeground(new java.awt.Color(255, 255, 255));
lbl_email.setText("Email");
panelGlass1.add(lbl_email, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 170, 201, -1));
jLabel7.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel7.setForeground(new java.awt.Color(255, 255, 255));
jLabel7.setText("NIK");
panelGlass1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, 48, -1));
jLabel18.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel18.setForeground(new java.awt.Color(255, 255, 255));
jLabel18.setText(":");
panelGlass1.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(76, 44, 14, -1));
lblNik.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lblNik.setForeground(new java.awt.Color(255, 255, 255));
lblNik.setText("Nik");
panelGlass1.add(lblNik, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 80, 79, -1));
getContentPane().add(panelGlass1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 110, 290, 240));
jLabel14.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel14.setForeground(new java.awt.Color(255, 255, 255));
jLabel14.setText("Tgl Peminjaman");
jLabel15.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel15.setForeground(new java.awt.Color(255, 255, 255));
jLabel15.setText("Lama Peminjaman");
jLabel32.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel32.setForeground(new java.awt.Color(255, 255, 255));
jLabel32.setText("Tgl Pengembalian");
jLabel37.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel37.setForeground(new java.awt.Color(255, 255, 255));
jLabel37.setText(":");
jLabel16.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel16.setForeground(new java.awt.Color(255, 255, 255));
jLabel16.setText(":");
jLabel17.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel17.setForeground(new java.awt.Color(255, 255, 255));
jLabel17.setText(":");
txt_total.setFont(new java.awt.Font("Arial", 1, 18)); // NOI18N
txt_total.setForeground(new java.awt.Color(255, 0, 0));
txt_total.setText("Total");
btn_Refresh__addItem.setForeground(new java.awt.Color(255, 255, 255));
btn_Refresh__addItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/calculator.png"))); // NOI18N
btn_Refresh__addItem.setText("Hitung");
btn_Refresh__addItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_Refresh__addItemActionPerformed(evt);
}
});
jLabel40.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N
jLabel40.setForeground(new java.awt.Color(255, 255, 255));
jLabel40.setText("RP");
jLabel40.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jLabel41.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel41.setForeground(new java.awt.Color(255, 255, 255));
jLabel41.setText("Hari");
javax.swing.GroupLayout panelGlass3Layout = new javax.swing.GroupLayout(panelGlass3);
panelGlass3.setLayout(panelGlass3Layout);
panelGlass3Layout.setHorizontalGroup(
panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass3Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass3Layout.createSequentialGroup()
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txt_lama, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel41)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(panelGlass3Layout.createSequentialGroup()
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass3Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(btn_Refresh__addItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelGlass3Layout.createSequentialGroup()
.addComponent(jLabel14)
.addGap(18, 18, 18)
.addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelGlass3Layout.createSequentialGroup()
.addComponent(jLabel32)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel37)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(60, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelGlass3Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel40, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(txt_total, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(50, 50, 50))
);
panelGlass3Layout.setVerticalGroup(
panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass3Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel14)
.addComponent(jLabel16))
.addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel37)
.addComponent(jLabel32))
.addComponent(jDateChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass3Layout.createSequentialGroup()
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel15)
.addComponent(jLabel17)
.addComponent(txt_lama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(3, 3, 3))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelGlass3Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel41)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btn_Refresh__addItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panelGlass3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txt_total)
.addComponent(jLabel40))
.addContainerGap(47, Short.MAX_VALUE))
);
getContentPane().add(panelGlass3, new org.netbeans.lib.awtextra.AbsoluteConstraints(630, 110, 320, 240));
boxnopol.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
boxnopolActionPerformed(evt);
}
});
jLabel8.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel8.setForeground(new java.awt.Color(255, 255, 255));
jLabel8.setText("Merek Mobil");
jLabel9.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel9.setForeground(new java.awt.Color(255, 255, 255));
jLabel9.setText("No. Polisi");
jLabel27.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel27.setForeground(new java.awt.Color(255, 255, 255));
jLabel27.setText("Tipe Mobil");
jLabel29.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel29.setForeground(new java.awt.Color(255, 255, 255));
jLabel29.setText("Tahun Mobil");
jLabel30.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel30.setForeground(new java.awt.Color(255, 255, 255));
jLabel30.setText(":");
jLabel31.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel31.setForeground(new java.awt.Color(255, 255, 255));
jLabel31.setText(":");
jLabel12.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel12.setForeground(new java.awt.Color(255, 255, 255));
jLabel12.setText(":");
jLabel13.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel13.setForeground(new java.awt.Color(255, 255, 255));
jLabel13.setText(":");
jLabel33.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel33.setForeground(new java.awt.Color(255, 255, 255));
jLabel33.setText("Harga (/hari)");
jLabel34.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel34.setForeground(new java.awt.Color(255, 255, 255));
jLabel34.setText(":");
lbl_merek.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lbl_merek.setForeground(new java.awt.Color(255, 255, 255));
lbl_merek.setText("lbl_merek");
lbl_tipe.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lbl_tipe.setForeground(new java.awt.Color(255, 255, 255));
lbl_tipe.setText("lbl_tipe");
lbl_tahun.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lbl_tahun.setForeground(new java.awt.Color(255, 255, 255));
lbl_tahun.setText("lbl_tahun");
lbl_harga.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lbl_harga.setForeground(new java.awt.Color(255, 255, 255));
lbl_harga.setText("lbl_harga");
jLabel36.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel36.setForeground(new java.awt.Color(255, 255, 255));
jLabel36.setText("Status");
lbl_status.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N
lbl_status.setForeground(new java.awt.Color(255, 255, 255));
lbl_status.setText("status");
jLabel38.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
jLabel38.setForeground(new java.awt.Color(255, 255, 255));
jLabel38.setText(":");
javax.swing.GroupLayout panelGlass2Layout = new javax.swing.GroupLayout(panelGlass2);
panelGlass2.setLayout(panelGlass2Layout);
panelGlass2Layout.setHorizontalGroup(
panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass2Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass2Layout.createSequentialGroup()
.addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(lbl_status)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(panelGlass2Layout.createSequentialGroup()
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel29)
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel27, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelGlass2Layout.createSequentialGroup()
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelGlass2Layout.createSequentialGroup()
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelGlass2Layout.createSequentialGroup()
.addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(boxnopol, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbl_merek, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbl_tipe, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbl_tahun, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(189, 189, 189))
.addGroup(panelGlass2Layout.createSequentialGroup()
.addComponent(jLabel34, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(lbl_harga, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))))
);
panelGlass2Layout.setVerticalGroup(
panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelGlass2Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jLabel13)
.addComponent(boxnopol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jLabel12)
.addComponent(lbl_merek))
.addGap(18, 18, 18)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel27)
.addComponent(jLabel31)
.addComponent(lbl_tipe))
.addGap(18, 18, 18)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel29)
.addComponent(jLabel30)
.addComponent(lbl_tahun))
.addGap(18, 18, 18)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel33)
.addComponent(jLabel34)
.addComponent(lbl_harga))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panelGlass2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel36)
.addComponent(jLabel38)
.addComponent(lbl_status))
.addContainerGap(39, Short.MAX_VALUE))
);
getContentPane().add(panelGlass2, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 110, 310, -1));
table_transaksi.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null}
},
new String [] {
"Nama Peminjam", "No Polisi", "Harga", "Tgl Pinjam", "Tgl Kembali", "Lama Pinjam", "Total"
}
) {
Class[] types = new Class [] {
java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane1.setViewportView(table_transaksi);
getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 510, 940, 210));
btn_Refresh__addItem1.setForeground(new java.awt.Color(255, 255, 255));
btn_Refresh__addItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/refresh.png"))); // NOI18N
btn_Refresh__addItem1.setText("Refresh");
btn_Refresh__addItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_Refresh__addItem1ActionPerformed(evt);
}
});
getContentPane().add(btn_Refresh__addItem1, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 390, 250, 80));
btn_create_addItem.setForeground(new java.awt.Color(255, 255, 255));
btn_create_addItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/pinjam.png"))); // NOI18N
btn_create_addItem.setText("Submit");
btn_create_addItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_create_addItemActionPerformed(evt);
}
});
getContentPane().add(btn_create_addItem, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 390, 250, 80));
jLabel6.setFont(new java.awt.Font("Arial", 1, 48)); // NOI18N
jLabel6.setForeground(new java.awt.Color(255, 255, 255));
jLabel6.setText("Form Transaksi Mobil");
getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 30, -1, -1));
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/backOk.png"))); // NOI18N
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
private void btn_Refresh__addItem1ActionPerformed(java.awt.event.ActionEvent evt) {
loadTabel();
}
private void btn_create_addItemActionPerformed(java.awt.event.ActionEvent evt) {
create();
add_peminjam();
}
private void boxnopolActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String st = (String) boxnopol.getSelectedItem();
ResultSet rst = con.querySelectAll("tb_mobil", "nopol='" + st + "'");
try {
while (rst.next()) {
this.lbl_merek.setText(rst.getString("merek"));
this.lbl_tipe.setText(rst.getString("tipe"));
this.lbl_tahun.setText(rst.getString("tahun"));
this.lbl_harga.setText(rst.getString("harga"));
this.lbl_status.setText(rst.getString("status"));
}
} catch (SQLException ex) {
Logger.getLogger(Form_Transaksi.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void btn_Refresh__addItemActionPerformed(java.awt.event.ActionEvent evt) {
hitungselisih();
}
/**
* @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(Form_Transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Form_Transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Form_Transaksi.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Form_Transaksi.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 Form_Transaksi(nama, nik, alamat, tlp, email).setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JComboBox boxnopol;
private usu.widget.ButtonGlass btn_Refresh__addItem;
private usu.widget.ButtonGlass btn_Refresh__addItem1;
private usu.widget.ButtonGlass btn_create_addItem;
private com.toedter.calendar.JDateChooser jDateChooser1;
private com.toedter.calendar.JDateChooser jDateChooser2;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel37;
private javax.swing.JLabel jLabel38;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel40;
private javax.swing.JLabel jLabel41;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel lblNama;
private javax.swing.JLabel lblNik;
private javax.swing.JLabel lbl_alamat;
private javax.swing.JLabel lbl_email;
private javax.swing.JLabel lbl_harga;
private javax.swing.JLabel lbl_merek;
private javax.swing.JLabel lbl_status;
private javax.swing.JLabel lbl_tahun;
private javax.swing.JLabel lbl_tipe;
private javax.swing.JLabel lbl_tlp;
private usu.widget.glass.PanelGlass panelGlass1;
private usu.widget.glass.PanelGlass panelGlass2;
private usu.widget.glass.PanelGlass panelGlass3;
private javax.swing.JTable table_transaksi;
private javax.swing.JTextField txt_lama;
private javax.swing.JLabel txt_total;
// End of variables declaration
private void loadMobil() { // mengambil database
rs = con.querySelectAll("tb_mobil");
try {
while (rs.next()) {
boxnopol.addItem(rs.getString("nopol"));
}
} catch (SQLException ex) {
Logger.getLogger(Form_Peminjam.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void hitungselisih() {
try {
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
String strDate1 = df.format(jDateChooser1.getDate());
String strDate2 = df.format(jDateChooser2.getDate());
Date Tanggal1 = df.parse(strDate1);
Date Tanggal2 = df.parse(strDate2);
long Hari1 = Tanggal1.getTime();
long Hari2 = Tanggal2.getTime();
long diff = Hari2 - Hari1;
long Lama = diff / (24 * 60 * 60 * 1000);
String Hasil = (Long.toString(Lama));
txt_lama.setText(Hasil);
int harga_sewa = Integer.parseInt(lbl_harga.getText()); // lbl_harga di pars ke integer
int lama_sewa = Integer.parseInt(txt_lama.getText()); // txt_lama di pars ke integer
int Total = harga_sewa * lama_sewa; // mencari total Harga
String a = Integer.toString(Total);
txt_total.setText(a);
} catch (Exception a) {
JOptionPane.showMessageDialog(this, "Masukan Tanggal Peminjaman dan Tanggal Pengembalian");
}
}
private void loadTabel() {
String namaKolom[] = {"id_transaksi", "peminjam", "nopol", "tgl_pinjaman", "tgl_kembali", "harga", "lama", "total"}; //,
rs = con.querySelect(namaKolom, "tb_transaksi");
table_transaksi.setModel(new ResultSetTable(rs)); //,"tgl_pinjam","tgl_kembali" ,jDateChooser1.getDateFormatString(),jDateChooser2.getDateFormatString()
}
private void create() {
try {
if (!lblNama.getText().isEmpty()) {
if (!jikakeluar()) {
JOptionPane.showMessageDialog(this, "maaf mobil ini sedang tidak tersedia");
} else {
String kolom[] = {"peminjam", "nopol", "tgl_pinjaman", "tgl_kembali", "harga", "lama", "total"};
java.util.Date tgl = (java.util.Date) this.jDateChooser1.getDate();
java.util.Date tgl1 = (java.util.Date) this.jDateChooser2.getDate();
String isi[] = {lblNama.getText(), boxnopol.getSelectedItem().toString(), new java.sql.Date(tgl.getTime()).toString(), new java.sql.Date(tgl1.getTime()).toString(), lbl_harga.getText(), txt_lama.getText(), txt_total.getText()};
System.out.println(con.queryInsert("tb_transaksi", kolom, isi));
JOptionPane.showMessageDialog(this, "Data Berhasil Disimpan");
cekstatus();
add_peminjam();
}
} else {
JOptionPane.showMessageDialog(this, "Data isian ada yang kosong");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Error input data");
System.out.println("salah");
}
loadTabel();
clear();
}
private void clear() {
txt_total.setText("");
txt_lama.setText("");
// boxnopol.addItem(rs.getString("nopol"));
//jDateChooser1.addNotify();
//jDateChooser2.addNotify();
}
public void cekstatus() throws SQLException {
rs = con.querySelectAll("tb_mobil", "nopol ='" + boxnopol.getSelectedItem().toString() + "'");
while (rs.next()) {
status1 = rs.getString("status");
}
String update_status = "Keluar";
String kolom[] = {"status"};
String isi[] = {update_status};
con.queryUpdate("tb_mobil", kolom, isi, "nopol='" + boxnopol.getSelectedItem().toString() + "'");
}
public boolean jikakeluar() throws SQLException {
boolean hasil;
rs = con.querySelectAll("tb_mobil", "nopol ='" + boxnopol.getSelectedItem().toString() + "'");
while (rs.next()) {
status1 = rs.getString("status");
}
if (status1.equals("Keluar")) {
hasil = false;
} else {
hasil = true;
}
return hasil;
}
public void add_peminjam() {
String kolom[] = {"nama", "alamat", "telp", "email"};
String isi[] = {lblNama.getText(), lbl_alamat.getText(), lbl_tlp.getText(), lbl_email.getText()};
System.out.println(con.queryInsert("tb_peminjam", kolom, isi));
JOptionPane.showMessageDialog(this, "Data Peminjam Berhasil Disimpan");
}
}