diff --git a/build/classes/guimybank/GUIMyBank$1.class b/build/classes/guimybank/GUIMyBank$1.class
index dc63c10..7d3609e 100644
Binary files a/build/classes/guimybank/GUIMyBank$1.class and b/build/classes/guimybank/GUIMyBank$1.class differ
diff --git a/build/classes/guimybank/GUIMyBank$2.class b/build/classes/guimybank/GUIMyBank$2.class
index de6832d..fe3e1a7 100644
Binary files a/build/classes/guimybank/GUIMyBank$2.class and b/build/classes/guimybank/GUIMyBank$2.class differ
diff --git a/build/classes/guimybank/GUIMyBank$3.class b/build/classes/guimybank/GUIMyBank$3.class
index ede5826..f1016fa 100644
Binary files a/build/classes/guimybank/GUIMyBank$3.class and b/build/classes/guimybank/GUIMyBank$3.class differ
diff --git a/build/classes/guimybank/GUIMyBank$4.class b/build/classes/guimybank/GUIMyBank$4.class
index 9b48610..59c429c 100644
Binary files a/build/classes/guimybank/GUIMyBank$4.class and b/build/classes/guimybank/GUIMyBank$4.class differ
diff --git a/build/classes/guimybank/GUIMyBank$5.class b/build/classes/guimybank/GUIMyBank$5.class
index 407ab98..33cc3ce 100644
Binary files a/build/classes/guimybank/GUIMyBank$5.class and b/build/classes/guimybank/GUIMyBank$5.class differ
diff --git a/build/classes/guimybank/GUIMyBank.class b/build/classes/guimybank/GUIMyBank.class
index f1a1b94..5c0db0a 100644
Binary files a/build/classes/guimybank/GUIMyBank.class and b/build/classes/guimybank/GUIMyBank.class differ
diff --git a/build/classes/guimybank/GUIMyBank.form b/build/classes/guimybank/GUIMyBank.form
index 0aad7ba..2ab9e11 100644
--- a/build/classes/guimybank/GUIMyBank.form
+++ b/build/classes/guimybank/GUIMyBank.form
@@ -188,6 +188,9 @@
+
+
+
diff --git a/src/guimybank/GUIMyBank.form b/src/guimybank/GUIMyBank.form
index 0aad7ba..2ab9e11 100644
--- a/src/guimybank/GUIMyBank.form
+++ b/src/guimybank/GUIMyBank.form
@@ -188,6 +188,9 @@
+
+
+
diff --git a/src/guimybank/GUIMyBank.java b/src/guimybank/GUIMyBank.java
index 3c299ac..f6a0294 100644
--- a/src/guimybank/GUIMyBank.java
+++ b/src/guimybank/GUIMyBank.java
@@ -42,7 +42,8 @@ public class GUIMyBank extends javax.swing.JFrame {
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
+ // //GEN-BEGIN:initComponents
private void initComponents() {
lblNome = new javax.swing.JLabel();
@@ -112,105 +113,139 @@ public class GUIMyBank extends javax.swing.JFrame {
btnVersamento.addActionListener(this::btnVersamentoActionPerformed);
btnPrelievo.setText("Prelievo");
+ btnPrelievo.addActionListener(this::btnPrelievoActionPerformed);
btnListaMovimenti.setText("Lista movimenti");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
- .addGap(17, 17, 17)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblDataDiNascita)
- .addComponent(lblSaldoIniziale))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addGroup(layout.createSequentialGroup()
- .addComponent(txtDataDiNascita, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(btnDataDiNascita, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(txtSaldoIniziale))
- .addGap(37, 37, 37)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(btnVersamento)
- .addComponent(btnPrelievo)
- .addComponent(btnListaMovimenti)))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblNome)
- .addComponent(lblCognome)
- .addComponent(lblCodiceFiscale))
- .addGap(26, 26, 26)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(txtCodiceFiscale, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(txtCognome, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)))))
- .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
- .addGap(99, 99, 99)
- .addComponent(btnAprireContoCorrente)))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout
+ .createSequentialGroup()
+ .addGap(17, 17, 17)
+ .addGroup(layout
+ .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblDataDiNascita)
+ .addComponent(lblSaldoIniziale))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING,
+ false)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(txtDataDiNascita,
+ javax.swing.GroupLayout.PREFERRED_SIZE,
+ 64,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(
+ javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(btnDataDiNascita,
+ javax.swing.GroupLayout.PREFERRED_SIZE,
+ 39,
+ javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(txtSaldoIniziale))
+ .addGap(37, 37, 37)
+ .addGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(btnVersamento)
+ .addComponent(btnPrelievo)
+ .addComponent(btnListaMovimenti)))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblNome)
+ .addComponent(lblCognome)
+ .addComponent(lblCodiceFiscale))
+ .addGap(26, 26, 26)
+ .addGroup(layout.createParallelGroup(
+ javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(txtNome,
+ javax.swing.GroupLayout.PREFERRED_SIZE,
+ 113,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtCodiceFiscale,
+ javax.swing.GroupLayout.PREFERRED_SIZE,
+ 115,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtCognome,
+ javax.swing.GroupLayout.PREFERRED_SIZE,
+ 113,
+ javax.swing.GroupLayout.PREFERRED_SIZE)))))
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
+ layout.createSequentialGroup()
+ .addGap(99, 99, 99)
+ .addComponent(btnAprireContoCorrente)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(14, 14, 14)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblNome)
- .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCognome)
- .addComponent(txtCognome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnVersamento))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCodiceFiscale)
- .addComponent(txtCodiceFiscale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnPrelievo))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblDataDiNascita)
- .addComponent(txtDataDiNascita, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btnDataDiNascita)
- .addComponent(btnListaMovimenti))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblSaldoIniziale)
- .addComponent(txtSaldoIniziale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(btnAprireContoCorrente)
- .addContainerGap(58, Short.MAX_VALUE))
- );
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(14, 14, 14)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblNome)
+ .addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblCognome)
+ .addComponent(txtCognome, javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnVersamento))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblCodiceFiscale)
+ .addComponent(txtCodiceFiscale, javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnPrelievo))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblDataDiNascita)
+ .addComponent(txtDataDiNascita, javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnDataDiNascita)
+ .addComponent(btnListaMovimenti))
+ .addGap(18, 18, 18)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblSaldoIniziale)
+ .addComponent(txtSaldoIniziale, javax.swing.GroupLayout.PREFERRED_SIZE,
+ javax.swing.GroupLayout.DEFAULT_SIZE,
+ javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addComponent(btnAprireContoCorrente)
+ .addContainerGap(58, Short.MAX_VALUE)));
pack();
}// //GEN-END:initComponents
- private void txtNomeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomeFocusGained
-txtNome.setBorder(borderOriginale);
- }//GEN-LAST:event_txtNomeFocusGained
+ private void txtNomeFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtNomeFocusGained
+ txtNome.setBorder(borderOriginale);
+ }// GEN-LAST:event_txtNomeFocusGained
- private void txtCognomeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCognomeFocusGained
-txtCognome.setBorder(borderOriginale);
- }//GEN-LAST:event_txtCognomeFocusGained
+ private void txtCognomeFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtCognomeFocusGained
+ txtCognome.setBorder(borderOriginale);
+ }// GEN-LAST:event_txtCognomeFocusGained
- private void txtCodiceFiscaleFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCodiceFiscaleFocusGained
+ private void txtCodiceFiscaleFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtCodiceFiscaleFocusGained
txtCodiceFiscale.setBorder(borderOriginale);
- }//GEN-LAST:event_txtCodiceFiscaleFocusGained
+ }// GEN-LAST:event_txtCodiceFiscaleFocusGained
- private void txtDataDiNascitaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtDataDiNascitaFocusGained
+ private void txtDataDiNascitaFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtDataDiNascitaFocusGained
txtDataDiNascita.setBorder(borderOriginale);
- }//GEN-LAST:event_txtDataDiNascitaFocusGained
+ }// GEN-LAST:event_txtDataDiNascitaFocusGained
- private void txtSaldoInizialeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtSaldoInizialeFocusGained
+ private void txtSaldoInizialeFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtSaldoInizialeFocusGained
txtSaldoIniziale.setBorder(borderOriginale);
- }//GEN-LAST:event_txtSaldoInizialeFocusGained
+ }// GEN-LAST:event_txtSaldoInizialeFocusGained
- private void btnVersamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVersamentoActionPerformed
+ private void btnVersamentoActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnVersamentoActionPerformed
String versamento;
boolean error;
@@ -226,9 +261,32 @@ txtCognome.setBorder(borderOriginale);
txtSaldoIniziale.setText(Double.toString(contoCorrente.getSaldo()));
}
} while (error);
- }//GEN-LAST:event_btnVersamentoActionPerformed
+ }// GEN-LAST:event_btnVersamentoActionPerformed
- private void btnAprireContoCorrenteActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnAprireContoCorrenteActionPerformed
+ private void btnPrelievoActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnPrelievoActionPerformed
+ String prelievo;
+ boolean error;
+
+ do {
+ error = false;
+ prelievo = JOptionPane.showInputDialog("Inserire l'importo da prelevare:");
+ if (!isNumeroValid(prelievo)) {
+ JOptionPane.showMessageDialog(null, "L'importo che si desidera prelevare non รจ valido.");
+ error = true;
+ } else {
+ try {
+ contoCorrente.preleva(Double.parseDouble(prelievo));
+ lblSaldoIniziale.setText("Saldo");
+ txtSaldoIniziale.setText(Double.toString(contoCorrente.getSaldo()));
+ } catch (IllegalArgumentException e) {
+ JOptionPane.showMessageDialog(null, e.getMessage());
+ error = true;
+ }
+ }
+ } while (error);
+ }// GEN-LAST:event_btnPrelievoActionPerformed
+
+ private void btnAprireContoCorrenteActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnAprireContoCorrenteActionPerformed
String nome = txtNome.getText();
String cognome = txtCognome.getText();
String codiceFiscale = txtCodiceFiscale.getText();