我已经为此工作了大约一个小时,试图使其正常运行,但无济于事。
我对Java很陌生,这是我第一次使用JFrame
s,但是由于某种原因,当我尝试JFrame
从另一个初始化它时,JFrame
它拒绝工作。
一步步:
NumberFormatExceptions
JFrame
对话盒设置为可见JFrame
没有出现 值得注意的是,对话框
JFrame
正在从另一个JFrame
被调用的StudentDetails
。
鼠标单击事件侦听器的代码:
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
int score1 = 0;
int score2 = 0;
int score3 = 0;
int score4 = 0;
int score5 = 0;
int score6 = 0;
dialogueBox db = new dialogueBox();
try {
score1 = Integer.parseInt(this.testScore1Input.getText());
score2 = Integer.parseInt(this.TestScore2Input.getText());
score3 = Integer.parseInt(this.testScore3Input.getText());
score4 = Integer.parseInt(this.testScore4Input.getText());
score5 = Integer.parseInt(this.testScore5Input.getText());
score6 = Integer.parseInt(this.testScore6Input.getText());
} catch (NumberFormatException numberFormatException) {
System.out.println(numberFormatException.toString());
db.setVisible(true);
}
int total = (score1 + score2 + score3 + score4 + score5 + score6);
float average = total / 6;
averageScoreOutput.setText(Float.toString(average));
}
我只是在寻找一些无法理解的原因,以及是否有人在使用JFrame
s时有最佳实践的技巧。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句