try {
int qtel = Integer.parseInt(certQtyTextField.getText());
if (qtel > 10 || qtel < 1) {
MessageBox.warn("数量,请填写1-10之间的数字!");
return;
}
} catch (Exception e) {
MessageBox.warn("数量,请填写1-10之间的数字!");
return;
}
try catch可以这么用:校验!
最新推荐文章于 2024-07-04 22:13:43 发布