Advertisement
Advertisement
| 06.14.2008 at 04:26AM PDT, ID: 23484901 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: |
float pound, rate, result;
pound = Float.parseFloat(jTextField2.getText());
rate = Float.parseFloat(jTextField1.getText());
if (jTextField1.getText().equals("")){ // If the field is null, request the user to enter a number
JOptionPane.showConfirmDialog((Component)
null, "Please enter a value for rate", "alert", JOptionPane.OK_CANCEL_OPTION);
}
else if (jTextField2.getText().equals("")){ // If the field is null, request the user to enter a number
JOptionPane.showConfirmDialog((Component)
null, "Please enter a value for pounds", "alert", JOptionPane.OK_CANCEL_OPTION);
}
else
{
result = pound*rate;
jTextField3.setText(String.valueOf(result));
}
}
|