删除文本框中的内容时出现错误我不知道为什么?
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1842)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at Frame.MainMenu.txt_payment_paymentKeyReleased(MainMenu.java:2198)
这里
private void txt_payment_paymentKeyReleased(java.awt.event.KeyEvent evt) {
// payers();
if(txt_payment_payment.equals("")){
txt_payment_change.setText("");
}else{
double a = Double.parseDouble(txt_payment_total.getText());
double b = Double.parseDouble(txt_payment_payment.getText());
double total = (b-a);
txt_payment_change.setText(Double.toString(total));
}
}