这是一个用于记录CA结果的Java Swing应用程序。该应用程序将要求学生输入他们的姓名,学号和CA等级。系统必须记住学生 具有最高和最低等级并在输入屏幕上显示它们。我目前在使用
时收到错误clearForm();
在我的GUI上编写保存按钮时。随后是clearform();和listResults();方法给了我错误。
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
// Creating a temp Result
result r = new result(nameTf.getText(), numTf.getText(), Integer.valueOf(resultTf.getText()));
// Saving it to the object array
registration[counter] = r;
// Checking the high value currently being stored, if it is higher than the new score, update
if (Integer.valueOf(highNum.getText()) < Integer.valueOf(resultTf.getText())) {
highNum.setText(resultTf.getText());
}
// Checking the low value currently being stored, if it is lower than the new score, update
if (Integer.valueOf(resultTf.getText()) < Integer.valueOf(lowNum.getText()) || counter == 0) {
lowNum.setText(resultTf.getText());
}
clearForm(); // clear the three input boxes when the user presses save
counter++; // Increment the student counter
listResults(); // List all stuudents currently stored in our object array
}
使用图像可以更轻松地询问这一点。