OK,终于搞定了.
还有个问题 请教一下.
private void updateSummer() {
try {
double a = Double.parseDouble(aField.getText());
double b = Double.parseDouble(bField.getText());
summerField.setText(String.valueOf(a + b));
} catch (NumberFormatException ex) {
summerField.setText("");
ex.printStackTrace();
//这边如果抛异常会出现 java.lang.NumberFormatException: empty String
}
}