Prelievo
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -188,6 +188,9 @@
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Prelievo"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPrelievoActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnListaMovimenti">
|
||||
<Properties>
|
||||
|
||||
@@ -188,6 +188,9 @@
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Prelievo"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPrelievoActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnListaMovimenti">
|
||||
<Properties>
|
||||
|
||||
@@ -42,7 +42,8 @@ public class GUIMyBank extends javax.swing.JFrame {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
||||
// Code">//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();
|
||||
}// </editor-fold>//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();
|
||||
|
||||
Reference in New Issue
Block a user