Implementati controlli sull'input

This commit is contained in:
2014-01-21 16:38:06 +01:00
parent 1a7c89eaac
commit f551fd854e
2 changed files with 208 additions and 8 deletions

View File

@@ -157,6 +157,19 @@ public class UserInterface extends JFrame{
catch (FileNotFoundException err){}
catch (IOException err){}
catch (ClassNotFoundException err){}
catch (NumberFormatException err){
JOptionPane.showMessageDialog(location,
"Input Non valido ",
"Error",
JOptionPane.ERROR_MESSAGE);
}
catch (NullPointerException err){
JOptionPane.showMessageDialog(location,
"Input Non valido ",
"Error",
JOptionPane.ERROR_MESSAGE);
}
}
@@ -184,14 +197,32 @@ public class UserInterface extends JFrame{
JOptionPane.showInputDialog(
location, "Inserire valutazione fornitore","Valutazione"));
if (valutazione <= 5 && valutazione >=1){
load_catalogo.offerteAttiveSenzaScadenza(login_data.getUsername(), offers, "0", valutazione);
}else{
JOptionPane.showMessageDialog(location,
"Input Non valido ",
"Error",
JOptionPane.ERROR_MESSAGE);
}
}
catch (FileNotFoundException err){}
catch (IOException err){}
catch (ClassNotFoundException err){}
catch (NumberFormatException err){
JOptionPane.showMessageDialog(location,
"Input Non valido ",
"Error",
JOptionPane.ERROR_MESSAGE);
}
catch (NullPointerException err){
JOptionPane.showMessageDialog(location,
"Input Non valido ",
"Error",
JOptionPane.ERROR_MESSAGE);
}
}
@@ -324,6 +355,11 @@ public class UserInterface extends JFrame{
load_catalogo.aggiungiCredito(login_data.getUsername(), importo_da_ricaricare );
l.setText("Bilancio" + " " + login_data.getUsername() + " = " + (Access.get_user_data(login_data.getUsername())).getBalance());
} else{
JOptionPane.showMessageDialog(location,
"Input Non valido ",
"Error",
JOptionPane.ERROR_MESSAGE);
}
}
catch (FileNotFoundException err){}
@@ -542,7 +578,7 @@ public class UserInterface extends JFrame{
setSize(600, 400);
setSize(650, 350);
setLocation(login_window.getLocation());
setTitle("User " + Access.get_user_data(login_data.getUsername()).getUser() + " Logged");
setVisible(true);