[quote name='BetaWar' date='5 Sep, 2008 - 05:42 AM' post='413212']
Try changing this:
CODE
if ((Ans).equals("NaN"));
if(true);
JOptionPane.showMessageDialog(null,"Try Again.","Inane warning",JOptionPane.ERROR_MESSAGE);
To something like this:
CODE
if ((Ans).equals("NaN"))
if(true)
JOptionPane.showMessageDialog(null,"Try Again.","Inane warning",JOptionPane.ERROR_MESSAGE);
or this:
CODE
if ((Ans).equals("NaN")){
if(true){
JOptionPane.showMessageDialog(null,"Try Again.","Inane warning",JOptionPane.ERROR_MESSAGE);
}
}
NOTE - Having a semi-colon after an if statement makes it think that the statement is complete and it just moves on, you code before was acting like so:
CODE
if ((Ans).equals("NaN")){
}
if(true){
}
JOptionPane.showMessageDialog(null,"Try Again.","Inane warning",JOptionPane.ERROR_MESSAGE);
So that nothing was happening in the if statements, and the JOptionPane was just aportion of th ecode that happened in a linear fashion without worrying about the if statements.
Hope that helps.
Thanks for your support
it didnt make much of a difference it still returns true even though NaN or Infinity is not present
ive tried this
if (txtProduct.setText(s).isNaN(Ans)){
}
if(true){
dialog should appear
i get an error saing double or float or void cannot be differenced
ive tried private Boolean either returns it false or true
catching failed to detect too
"NaN" .isNaN i was told .isNaN is a more accurate method
This post has been edited by Ak-Emm: 5 Sep, 2008 - 06:23 AM