Pulsante chiudi
This commit is contained in:
@@ -276,6 +276,9 @@
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Chiudi"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnChiudiActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="pnlCorsi">
|
||||
|
||||
|
||||
@@ -27,6 +27,12 @@ public class RegistrazionePalestra extends javax.swing.JFrame {
|
||||
*/
|
||||
public RegistrazionePalestra() {
|
||||
initComponents();
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
btnChiudiActionPerformed(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,6 +44,7 @@ public class RegistrazionePalestra extends javax.swing.JFrame {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
||||
// Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
@@ -141,6 +148,7 @@ public class RegistrazionePalestra extends javax.swing.JFrame {
|
||||
btnCancella.addActionListener(this::btnCancellaActionPerformed);
|
||||
|
||||
btnChiudi.setText("Chiudi");
|
||||
btnChiudi.addActionListener(this::btnChiudiActionPerformed);
|
||||
|
||||
chkFitness.setText("Fitness");
|
||||
chkFitness.addActionListener(this::chkFitnessActionPerformed);
|
||||
@@ -343,6 +351,35 @@ public class RegistrazionePalestra extends javax.swing.JFrame {
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnChiudiActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnChiudiActionPerformed
|
||||
|
||||
if (isRegistrazioneNonSalvata()) {
|
||||
switch (JOptionPane.showConfirmDialog(null, "Salvare?", "Esci", JOptionPane.YES_NO_OPTION)) {
|
||||
case 0:
|
||||
btnRegistraActionPerformed(evt);
|
||||
break;
|
||||
case 1:
|
||||
System.exit(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
System.exit(0);
|
||||
}
|
||||
}// GEN-LAST:event_btnChiudiActionPerformed
|
||||
|
||||
private boolean isRegistrazioneNonSalvata() {
|
||||
return !(txtNome.getText().isEmpty() &&
|
||||
txtCognome.getText().isEmpty() &&
|
||||
txtCodiceFiscale.getText().isEmpty() &&
|
||||
txtEmail.getText().isEmpty() &&
|
||||
new String(txtPassword.getPassword()).isEmpty() &&
|
||||
getSelectedSesso() == -1 &&
|
||||
getSelectedCorsi().isEmpty() &&
|
||||
txtaNote.getText().isEmpty());
|
||||
}
|
||||
|
||||
private void btnCancellaActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancellaActionPerformed
|
||||
txtNome.setText("");
|
||||
txtCognome.setText("");
|
||||
|
||||
Reference in New Issue
Block a user