-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrmEventos.java
More file actions
568 lines (507 loc) · 28.1 KB
/
frmEventos.java
File metadata and controls
568 lines (507 loc) · 28.1 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package textoSecreto;
import java.awt.Color;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
*
* @author danielsalnikov
*/
public class frmEventos extends javax.swing.JFrame {
/**
* Creates new form frmEventos
*/
Bonos[] bonds = new Bonos[100];
String pass = "12345";
JFrame frame = new JFrame("Text:");
int k = 0;
int numB = 0;
String aux = "";
double uti []=new double [100];
double rends[] = new double[100];
String name [] = new String [100];
public frmEventos() {
initComponents();
setTitle("Bond Management");
setLocationRelativeTo(null);
this.cmbTipo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Compound", "Simple"}));
this.panelSeguridad.setVisible(false);
JOptionPane.showMessageDialog(frame,
"Enter password to access bond calculator",
"Security", JOptionPane.INFORMATION_MESSAGE);
}
public void setup(){
this.jTextField1.setText("Enter bond name");
this.jTextField2.setText("Enter principal amount");
this.jTextField3.setText("Enter interest rate in %");
this.jTextField4.setText("Enter length in years");
this.jTextArea1.setText("");
this.name = new String [100];
this.uti = new double [100];
this.numB = 0;
this.aux = "";
this.bonds = new Bonos [100];
this.rends = new double[100];
}
/**
* 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() {
jButton2 = new javax.swing.JButton();
lblLogo = new javax.swing.JLabel();
jPasswordField1 = new javax.swing.JPasswordField();
btnValidar = new javax.swing.JButton();
panelSeguridad = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
cmbTipo = new javax.swing.JComboBox<>();
jTextField4 = new javax.swing.JTextField();
btnPara = new javax.swing.JButton();
btnSurprise = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
btnPrint = new javax.swing.JButton();
btnRegister = new javax.swing.JButton();
btnGraph = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton2.setText("jButton2");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
btnValidar.setText("Confirm");
btnValidar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnValidarActionPerformed(evt);
}
});
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
jTextField1.setText("Ingrese nombre del bono");
jTextField1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTextField1MouseClicked(evt);
}
});
jTextField2.setText("Ingrese valor principal");
jTextField2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTextField2MouseClicked(evt);
}
});
jTextField3.setText("Ingrese tasa de interés");
jTextField3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTextField3MouseClicked(evt);
}
});
jButton1.setText("Enter data");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
cmbTipo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Compuesto", "Simple"}));
jTextField4.setText("Ingrese duración ");
jTextField4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTextField4MouseClicked(evt);
}
});
jTextField4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField4ActionPerformed(evt);
}
});
btnPara.setText("Compute parameters");
btnPara.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnParaActionPerformed(evt);
}
});
btnSurprise.setText("surprise");
btnSurprise.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSurpriseActionPerformed(evt);
}
});
jLabel2.setText("Select interest type");
btnPrint.setText("Print info");
btnPrint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPrintActionPerformed(evt);
}
});
btnRegister.setText("Register bond");
btnRegister.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnRegisterActionPerformed(evt);
}
});
btnGraph.setText("Graph bonds");
btnGraph.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnGraphActionPerformed(evt);
}
});
jButton5.setText("Restart");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jLabel3.setText("Portfolio information");
jLabel4.setText("Single bond information");
jLabel5.setText("*Limited to one-hundred bonds at a time");
javax.swing.GroupLayout panelSeguridadLayout = new javax.swing.GroupLayout(panelSeguridad);
panelSeguridad.setLayout(panelSeguridadLayout);
panelSeguridadLayout.setHorizontalGroup(
panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSeguridadLayout.createSequentialGroup()
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSeguridadLayout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnGraph)
.addComponent(jButton5)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnPrint)
.addComponent(btnSurprise))
.addGap(94, 94, 94))
.addGroup(panelSeguridadLayout.createSequentialGroup()
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSeguridadLayout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(btnPara, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnRegister)))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)))
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(cmbTipo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTextField4)
.addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
.addComponent(jTextField2)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelSeguridadLayout.createSequentialGroup()
.addGap(9, 9, 9)
.addComponent(jLabel2)))
.addComponent(jLabel5))
.addContainerGap())
.addGroup(panelSeguridadLayout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(jLabel4)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelSeguridadLayout.setVerticalGroup(
panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSeguridadLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSeguridadLayout.createSequentialGroup()
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelSeguridadLayout.createSequentialGroup()
.addGap(22, 22, 22)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cmbTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelSeguridadLayout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnPara)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnRegister)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnPrint)
.addComponent(btnGraph)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelSeguridadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnSurprise)
.addComponent(jButton5))
.addContainerGap())
);
jLabel1.setText("Bond performance calculations");
jButton3.setText("Quit program");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Go to encryption form");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblLogo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(46, 46, 46))
.addGroup(layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(panelSeguridad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(61, 61, 61)
.addComponent(jButton3)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPasswordField1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnValidar, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())))))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(112, 112, 112)
.addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(27, 27, 27)
.addComponent(btnValidar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3)
.addGap(6, 6, 6))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelSeguridad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(12, 12, 12))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnValidarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnValidarActionPerformed
aux = "Remaining attempts: ";
if (String.copyValueOf(this.jPasswordField1.getPassword()).equals(pass)) {
JOptionPane.showMessageDialog(frame,
"Access granted",
"Security", JOptionPane.INFORMATION_MESSAGE);
this.btnValidar.setVisible(false);
this.jPasswordField1.setVisible(false);
this.panelSeguridad.setVisible(true);
setup();
} else {
if (!String.copyValueOf(this.jPasswordField1.getPassword()).equals(pass)) {
JOptionPane.showMessageDialog(frame,
"Access denied",
"Security", JOptionPane.INFORMATION_MESSAGE);
k++;
aux = aux + Integer.toString(4 - k);
JOptionPane.showMessageDialog(frame,
aux,
"Security", JOptionPane.INFORMATION_MESSAGE);
if (k == 4) {
System.exit(0);
}
}
}
}//GEN-LAST:event_btnValidarActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if (this.cmbTipo.getSelectedIndex() == 0) {
aux = "compound";
bonds[numB] = new compound(this.jTextField1.getText(),
Double.parseDouble(this.jTextField2.getText()),
Double.parseDouble(this.jTextField3.getText()),
Integer.parseInt(this.jTextField4.getText()), aux);
} else {
aux = "simple";
bonds[numB] = new simple(this.jTextField1.getText(),
Double.parseDouble(this.jTextField2.getText()),
Double.parseDouble(this.jTextField3.getText()),
Integer.parseInt(this.jTextField4.getText()), aux);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void btnSurpriseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSurpriseActionPerformed
Graphs fram = new Graphs();
fram.setSize(400, 300);
fram.setBackground(Color.WHITE);
fram.setTitle("Sine and cosine graphs");
fram.setLocationRelativeTo(null);
fram.setVisible(true);
}//GEN-LAST:event_btnSurpriseActionPerformed
private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField4ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField4ActionPerformed
private void jTextField1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField1MouseClicked
this.jTextField1.setText("");
}//GEN-LAST:event_jTextField1MouseClicked
private void btnParaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnParaActionPerformed
rends[numB] = bonds[numB].Rendimiento();
uti[numB] = bonds[numB].utilidad();
this.name[numB]=this.jTextField1.getText();
this.jTextArea1.setText("Performance: $" + Math.round(rends[numB] * 100.0) / 100.0 + "\n\n"
+ "Profit: $" + Math.round(uti[numB] * 100.0) / 100.0);
}//GEN-LAST:event_btnParaActionPerformed
private void btnRegisterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRegisterActionPerformed
this.jTextField1.setText("Enter bond name");
this.jTextField2.setText("Enter principal amount");
this.jTextField3.setText("Enter interest rate in %");
this.jTextField4.setText("Enter length in years");
this.jTextArea1.setText("");
numB++;
}//GEN-LAST:event_btnRegisterActionPerformed
private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrintActionPerformed
String proxy = "";
for (int i = 0; i < numB; i++) {
proxy += bonds[i];
}
this.jTextArea1.setText(proxy);
}//GEN-LAST:event_btnPrintActionPerformed
private void btnGraphActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraphActionPerformed
JFrame fram = new JFrame("Bond profit comparison");
fram.setSize(400, 300);
double rend []=new double [numB];
String labels []=new String [numB];
for (int i=0;i<numB;i++){
rend[i]=uti[i];
labels[i]=name[i];
}
String tit="Bonds";
graphBonds bc= new graphBonds(rend, labels, tit);
fram.add(bc);
if (numB>0){
fram.setVisible(true);
} else {
JOptionPane.showMessageDialog(fram, "Please be sure the portfolio isn't empty",
"Bond performance", JOptionPane.INFORMATION_MESSAGE);
}
}//GEN-LAST:event_btnGraphActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
System.exit(0);
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
new frmCripto().setVisible(true);
setVisible(false);
}//GEN-LAST:event_jButton4ActionPerformed
private void jTextField2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField2MouseClicked
this.jTextField2.setText("");
}//GEN-LAST:event_jTextField2MouseClicked
private void jTextField3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField3MouseClicked
this.jTextField3.setText("");
}//GEN-LAST:event_jTextField3MouseClicked
private void jTextField4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField4MouseClicked
this.jTextField4.setText("");
}//GEN-LAST:event_jTextField4MouseClicked
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
JFrame framed = new JFrame("Message cleared");
setup();
JOptionPane.showMessageDialog(framed, "The bonds have been deleted, "
+ "you may now enter a new portfolio.", "Portfolio Emptied",
JOptionPane.INFORMATION_MESSAGE);
}//GEN-LAST:event_jButton5ActionPerformed
/**
* @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(frmEventos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(frmEventos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(frmEventos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(frmEventos.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() {
new frmEventos().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnGraph;
private javax.swing.JButton btnPara;
private javax.swing.JButton btnPrint;
private javax.swing.JButton btnRegister;
private javax.swing.JButton btnSurprise;
private javax.swing.JButton btnValidar;
private javax.swing.JComboBox<String> cmbTipo;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JLabel lblLogo;
private javax.swing.JPanel panelSeguridad;
// End of variables declaration//GEN-END:variables
}