-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkalkulator.java
591 lines (529 loc) · 27.4 KB
/
kalkulator.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
import java.text.DecimalFormat;
public class kalkulator extends javax.swing.JFrame {
String angka;
int pilih;
double angka1,angka2,jumlah;
DecimalFormat df=new DecimalFormat("###.#");
String dicky1,dicky2,dicky3,dicky4,dicky5;
public kalkulator() {
initComponents();
angka="";
}
void koma (){
angka+=".";
jTextField1.setText(angka);
}
void angka1 (){
angka+="1";
jTextField1.setText(angka);
}
void angka2 (){
angka+="2";
jTextField1.setText(angka);
}
void angka3 (){
angka+="3";
jTextField1.setText(angka);
}
void angka4 (){
angka+="4";
jTextField1.setText(angka);
}
void angka5 (){
angka+="5";
jTextField1.setText(angka);
}
void angka6 (){
angka+="6";
jTextField1.setText(angka);
}
void angka7 (){
angka+="7";
jTextField1.setText(angka);
}
void angka8 (){
angka+="8";
jTextField1.setText(angka);
}
void angka9 (){
angka+="9";
jTextField1.setText(angka);
}
void angka0 (){
angka+="0";
jTextField1.setText(angka);
}
void hasil (){
switch(pilih){
case 1:
angka2=Double.parseDouble(angka);
jumlah=angka1+angka2;
angka=Double.toString(jumlah);
String dicky1 =df.format(jumlah);
jTextField1.setText(dicky1);
break;
case 2:
angka2=Double.parseDouble(angka);
jumlah=angka1-angka2;
angka=Double.toString(jumlah);
String dicky2 =df.format(jumlah);
jTextField1.setText(dicky2);
break;
case 3:
angka2=Double.parseDouble(angka);
jumlah=angka1*angka2;
angka=Double.toString(jumlah);
String dicky3 =df.format(jumlah);
jTextField1.setText(dicky3);
break;
case 4:
angka2=Double.parseDouble(angka);
jumlah=angka1/angka2;
angka=Double.toString(jumlah);
String dicky4 =df.format(jumlah);
jTextField1.setText(dicky4);
break;
case 5:
angka2=Double.parseDouble(angka);
jumlah=Math.pow(angka1,angka2);
angka=Double.toString(jumlah);
String dicky5 =df.format(jumlah);
jTextField1.setText(dicky5);
break;
}
}
void tambah (){
angka1=Double.parseDouble(angka);
jTextField1.setText("+");
angka="";
pilih=1;
}
void kali (){
angka1=Double.parseDouble(angka);
jTextField1.setText("*");
angka="";
pilih=3;
}
void bagi (){
angka1=Double.parseDouble(angka);
jTextField1.setText("/");
angka="";
pilih=4;
}
void kurang (){
angka1=Double.parseDouble(angka);
jTextField1.setText("-");
angka="";
pilih=2;
}
void pangkat (){
angka1=Double.parseDouble(angka);
jTextField1.setText("^");
angka="";
pilih=5;
}
/**
* 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() {
jTextField1 = new javax.swing.JTextField();
btn7 = new javax.swing.JButton();
btn9 = new javax.swing.JButton();
btn8 = new javax.swing.JButton();
btn5 = new javax.swing.JButton();
btn4 = new javax.swing.JButton();
btn6 = new javax.swing.JButton();
btn1 = new javax.swing.JButton();
btn2 = new javax.swing.JButton();
btn3 = new javax.swing.JButton();
btntambah = new javax.swing.JButton();
btnkali = new javax.swing.JButton();
btnbagi = new javax.swing.JButton();
btnkurang = new javax.swing.JButton();
btnkoma = new javax.swing.JButton();
btn0 = new javax.swing.JButton();
btnsamadengan = new javax.swing.JButton();
btnc = new javax.swing.JButton();
pangkat = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(255, 102, 255));
setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
setForeground(new java.awt.Color(255, 255, 102));
setResizable(false);
jTextField1.setBackground(new java.awt.Color(51, 255, 204));
jTextField1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
btn7.setBackground(new java.awt.Color(102, 102, 255));
btn7.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn7.setForeground(new java.awt.Color(255, 0, 0));
btn7.setText("7");
btn7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn7ActionPerformed(evt);
}
});
btn9.setBackground(new java.awt.Color(102, 102, 255));
btn9.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn9.setForeground(new java.awt.Color(255, 0, 0));
btn9.setText("9");
btn9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn9ActionPerformed(evt);
}
});
btn8.setBackground(new java.awt.Color(102, 102, 255));
btn8.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn8.setForeground(new java.awt.Color(255, 0, 0));
btn8.setText("8");
btn8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn8ActionPerformed(evt);
}
});
btn5.setBackground(new java.awt.Color(102, 102, 255));
btn5.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn5.setForeground(new java.awt.Color(255, 0, 0));
btn5.setText("5");
btn5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn5ActionPerformed(evt);
}
});
btn4.setBackground(new java.awt.Color(102, 102, 255));
btn4.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn4.setForeground(new java.awt.Color(255, 0, 0));
btn4.setText("4");
btn4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn4ActionPerformed(evt);
}
});
btn6.setBackground(new java.awt.Color(102, 102, 255));
btn6.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn6.setForeground(new java.awt.Color(255, 0, 0));
btn6.setText("6");
btn6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn6ActionPerformed(evt);
}
});
btn1.setBackground(new java.awt.Color(102, 102, 255));
btn1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn1.setForeground(new java.awt.Color(255, 0, 0));
btn1.setText("1");
btn1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn1ActionPerformed(evt);
}
});
btn2.setBackground(new java.awt.Color(102, 102, 255));
btn2.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn2.setForeground(new java.awt.Color(255, 0, 0));
btn2.setText("2");
btn2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn2ActionPerformed(evt);
}
});
btn3.setBackground(new java.awt.Color(102, 102, 255));
btn3.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn3.setForeground(new java.awt.Color(255, 0, 0));
btn3.setText("3");
btn3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn3ActionPerformed(evt);
}
});
btntambah.setBackground(new java.awt.Color(0, 255, 0));
btntambah.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btntambah.setForeground(new java.awt.Color(255, 0, 0));
btntambah.setText("+");
btntambah.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btntambahActionPerformed(evt);
}
});
btnkali.setBackground(new java.awt.Color(0, 255, 0));
btnkali.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btnkali.setForeground(new java.awt.Color(255, 0, 0));
btnkali.setText("*");
btnkali.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnkaliActionPerformed(evt);
}
});
btnbagi.setBackground(new java.awt.Color(0, 255, 0));
btnbagi.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btnbagi.setForeground(new java.awt.Color(255, 0, 0));
btnbagi.setText("/");
btnbagi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnbagiActionPerformed(evt);
}
});
btnkurang.setBackground(new java.awt.Color(0, 255, 0));
btnkurang.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btnkurang.setForeground(new java.awt.Color(255, 0, 0));
btnkurang.setText("-");
btnkurang.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnkurangActionPerformed(evt);
}
});
btnkoma.setBackground(new java.awt.Color(0, 204, 0));
btnkoma.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btnkoma.setForeground(new java.awt.Color(255, 0, 0));
btnkoma.setText(".");
btnkoma.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnkomaActionPerformed(evt);
}
});
btn0.setBackground(new java.awt.Color(102, 102, 255));
btn0.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btn0.setForeground(new java.awt.Color(255, 0, 0));
btn0.setText("0");
btn0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn0ActionPerformed(evt);
}
});
btnsamadengan.setBackground(new java.awt.Color(0, 255, 0));
btnsamadengan.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btnsamadengan.setForeground(new java.awt.Color(255, 0, 0));
btnsamadengan.setText("=");
btnsamadengan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnsamadenganActionPerformed(evt);
}
});
btnc.setBackground(new java.awt.Color(255, 255, 51));
btnc.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
btnc.setForeground(new java.awt.Color(255, 0, 0));
btnc.setText("C");
btnc.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btncActionPerformed(evt);
}
});
pangkat.setBackground(new java.awt.Color(0, 204, 0));
pangkat.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
pangkat.setForeground(new java.awt.Color(255, 0, 0));
pangkat.setText("^");
pangkat.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pangkatActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn0, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btn7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btn8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(btnc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(pangkat)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnsamadengan, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btn9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnkoma, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnkurang, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btntambah, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnkali, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnbagi, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn7, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn8, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn9, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnkali, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(14, 14, 14)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn6, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn5, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn4, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnbagi, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(14, 14, 14)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn3, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn2, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btntambah, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnkurang, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnkoma, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn0, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnsamadengan, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnc, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(pangkat, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(27, Short.MAX_VALUE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void btn9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn9ActionPerformed
angka9();
}//GEN-LAST:event_btn9ActionPerformed
private void btn6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn6ActionPerformed
angka6();
}//GEN-LAST:event_btn6ActionPerformed
private void btn3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn3ActionPerformed
angka3();
}//GEN-LAST:event_btn3ActionPerformed
private void btn0ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn0ActionPerformed
angka0();
}//GEN-LAST:event_btn0ActionPerformed
private void btn7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn7ActionPerformed
angka7();
}//GEN-LAST:event_btn7ActionPerformed
private void btn8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn8ActionPerformed
angka8();
}//GEN-LAST:event_btn8ActionPerformed
private void btn1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn1ActionPerformed
angka1();
}//GEN-LAST:event_btn1ActionPerformed
private void btn2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn2ActionPerformed
angka2();
}//GEN-LAST:event_btn2ActionPerformed
private void btn4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn4ActionPerformed
angka4();
}//GEN-LAST:event_btn4ActionPerformed
private void btn5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn5ActionPerformed
angka5(); // TODO add your handling code here:
}//GEN-LAST:event_btn5ActionPerformed
private void btntambahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btntambahActionPerformed
tambah(); // TODO add your handling code here:
}//GEN-LAST:event_btntambahActionPerformed
private void btnkaliActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnkaliActionPerformed
kali(); // TODO add your handling code here:
}//GEN-LAST:event_btnkaliActionPerformed
private void btnbagiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnbagiActionPerformed
bagi(); // TODO add your handling code here:
}//GEN-LAST:event_btnbagiActionPerformed
private void btnkurangActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnkurangActionPerformed
kurang(); // TODO add your handling code here:
}//GEN-LAST:event_btnkurangActionPerformed
private void btncActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncActionPerformed
jTextField1.setText("");
angka1=(int) 0.0;
angka2=(int) 0.0;
jumlah=(int) 0.0;
angka="";
}//GEN-LAST:event_btncActionPerformed
private void btnsamadenganActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnsamadenganActionPerformed
hasil(); // TODO add your handling code here:
}//GEN-LAST:event_btnsamadenganActionPerformed
private void btnkomaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnkomaActionPerformed
koma();
}//GEN-LAST:event_btnkomaActionPerformed
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1ActionPerformed
private void pangkatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pangkatActionPerformed
pangkat(); // TODO add your handling code here:
}//GEN-LAST:event_pangkatActionPerformed
/**
* @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(kalkulator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(kalkulator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(kalkulator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(kalkulator.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 kalkulator().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btn0;
private javax.swing.JButton btn1;
private javax.swing.JButton btn2;
private javax.swing.JButton btn3;
private javax.swing.JButton btn4;
private javax.swing.JButton btn5;
private javax.swing.JButton btn6;
private javax.swing.JButton btn7;
private javax.swing.JButton btn8;
private javax.swing.JButton btn9;
private javax.swing.JButton btnbagi;
private javax.swing.JButton btnc;
private javax.swing.JButton btnkali;
private javax.swing.JButton btnkoma;
private javax.swing.JButton btnkurang;
private javax.swing.JButton btnsamadengan;
private javax.swing.JButton btntambah;
private javax.swing.JTextField jTextField1;
private javax.swing.JButton pangkat;
// End of variables declaration//GEN-END:variables
// private void pangkat() {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
// private void koma() {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
// }
}