I have a jPanel with few jtextfields. The values (character or numbers) of this jtext are used to complete a jtable. So i need to be sure they are full before to add to my table. So i created this function :
public boolean checkInputsEquipe ()
{
if (jTextFieldEquipeNom.getText() == null ||
jTextFieldEquipeAnnee.getText()==null ||
jTextFieldEquipeCdmId.getText()==null ||
jTextFieldEquipePaysId.getText()==null )
{
return false;
}
else{
try
{
Integer.parseInt(jTextFieldEquipeAnnee.getText());
Integer.parseInt(jTextFieldEquipeCdmId.getText());
Integer.parseInt(jTextFieldEquipePaysId.getText());
return true;
}
catch (Exception ex)
{
return false;
}
}
}
But when i filled up all my jtextfields, checkInputsEquipe() is False instead of being True. Why ? Or do you have a better way to do this ?
Aucun commentaire:
Enregistrer un commentaire