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>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Prelievo"/>
|
<Property name="text" type="java.lang.String" value="Prelievo"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPrelievoActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JButton" name="btnListaMovimenti">
|
<Component class="javax.swing.JButton" name="btnListaMovimenti">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|||||||
@@ -188,6 +188,9 @@
|
|||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value="Prelievo"/>
|
<Property name="text" type="java.lang.String" value="Prelievo"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPrelievoActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JButton" name="btnListaMovimenti">
|
<Component class="javax.swing.JButton" name="btnListaMovimenti">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ public class GUIMyBank extends javax.swing.JFrame {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
// <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() {
|
private void initComponents() {
|
||||||
|
|
||||||
lblNome = new javax.swing.JLabel();
|
lblNome = new javax.swing.JLabel();
|
||||||
@@ -112,105 +113,139 @@ public class GUIMyBank extends javax.swing.JFrame {
|
|||||||
btnVersamento.addActionListener(this::btnVersamentoActionPerformed);
|
btnVersamento.addActionListener(this::btnVersamentoActionPerformed);
|
||||||
|
|
||||||
btnPrelievo.setText("Prelievo");
|
btnPrelievo.setText("Prelievo");
|
||||||
|
btnPrelievo.addActionListener(this::btnPrelievoActionPerformed);
|
||||||
|
|
||||||
btnListaMovimenti.setText("Lista movimenti");
|
btnListaMovimenti.setText("Lista movimenti");
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout
|
||||||
.addGap(17, 17, 17)
|
.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGap(17, 17, 17)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(lblDataDiNascita)
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(lblSaldoIniziale))
|
.addGroup(layout.createParallelGroup(
|
||||||
.addGap(18, 18, 18)
|
javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
.addComponent(lblDataDiNascita)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addComponent(lblSaldoIniziale))
|
||||||
.addComponent(txtDataDiNascita, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGap(18, 18, 18)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addGroup(layout.createParallelGroup(
|
||||||
.addComponent(btnDataDiNascita, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
|
javax.swing.GroupLayout.Alignment.LEADING,
|
||||||
.addComponent(txtSaldoIniziale))
|
false)
|
||||||
.addGap(37, 37, 37)
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addComponent(txtDataDiNascita,
|
||||||
.addComponent(btnVersamento)
|
javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
.addComponent(btnPrelievo)
|
64,
|
||||||
.addComponent(btnListaMovimenti)))
|
javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addPreferredGap(
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(lblNome)
|
.addComponent(btnDataDiNascita,
|
||||||
.addComponent(lblCognome)
|
javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
.addComponent(lblCodiceFiscale))
|
39,
|
||||||
.addGap(26, 26, 26)
|
javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addComponent(txtSaldoIniziale))
|
||||||
.addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGap(37, 37, 37)
|
||||||
.addComponent(txtCodiceFiscale, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGroup(layout.createParallelGroup(
|
||||||
.addComponent(txtCognome, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
.addComponent(btnVersamento)
|
||||||
.addGap(99, 99, 99)
|
.addComponent(btnPrelievo)
|
||||||
.addComponent(btnAprireContoCorrente)))
|
.addComponent(btnListaMovimenti)))
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
.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.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(14, 14, 14)
|
.addGap(14, 14, 14)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(lblNome)
|
.addComponent(lblNome)
|
||||||
.addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(txtNome, javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(lblCognome)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(txtCognome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(btnVersamento))
|
.addComponent(lblCognome)
|
||||||
.addGap(18, 18, 18)
|
.addComponent(txtCognome, javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
.addComponent(lblCodiceFiscale)
|
javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(txtCodiceFiscale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(btnVersamento))
|
||||||
.addComponent(btnPrelievo))
|
.addGap(18, 18, 18)
|
||||||
.addGap(18, 18, 18)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addComponent(lblCodiceFiscale)
|
||||||
.addComponent(lblDataDiNascita)
|
.addComponent(txtCodiceFiscale, javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
.addComponent(txtDataDiNascita, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
.addComponent(btnDataDiNascita)
|
javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(btnListaMovimenti))
|
.addComponent(btnPrelievo))
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(lblSaldoIniziale)
|
.addComponent(lblDataDiNascita)
|
||||||
.addComponent(txtSaldoIniziale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(txtDataDiNascita, javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
.addGap(18, 18, 18)
|
javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
.addComponent(btnAprireContoCorrente)
|
javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addContainerGap(58, Short.MAX_VALUE))
|
.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();
|
pack();
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void txtNomeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNomeFocusGained
|
private void txtNomeFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtNomeFocusGained
|
||||||
txtNome.setBorder(borderOriginale);
|
txtNome.setBorder(borderOriginale);
|
||||||
}//GEN-LAST:event_txtNomeFocusGained
|
}// GEN-LAST:event_txtNomeFocusGained
|
||||||
|
|
||||||
private void txtCognomeFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCognomeFocusGained
|
private void txtCognomeFocusGained(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtCognomeFocusGained
|
||||||
txtCognome.setBorder(borderOriginale);
|
txtCognome.setBorder(borderOriginale);
|
||||||
}//GEN-LAST:event_txtCognomeFocusGained
|
}// 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);
|
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);
|
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);
|
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;
|
String versamento;
|
||||||
boolean error;
|
boolean error;
|
||||||
|
|
||||||
@@ -226,7 +261,30 @@ txtCognome.setBorder(borderOriginale);
|
|||||||
txtSaldoIniziale.setText(Double.toString(contoCorrente.getSaldo()));
|
txtSaldoIniziale.setText(Double.toString(contoCorrente.getSaldo()));
|
||||||
}
|
}
|
||||||
} while (error);
|
} while (error);
|
||||||
}//GEN-LAST:event_btnVersamentoActionPerformed
|
}// GEN-LAST:event_btnVersamentoActionPerformed
|
||||||
|
|
||||||
|
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
|
private void btnAprireContoCorrenteActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnAprireContoCorrenteActionPerformed
|
||||||
String nome = txtNome.getText();
|
String nome = txtNome.getText();
|
||||||
|
|||||||
Reference in New Issue
Block a user