Reputation: 23
This is what I currently have:
private void EnterBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (isValidData())
{
int count = 0;
int score = Integer.parseInt(TestScoreTF.getText());
int sumScore = 0;
int sumScores = sumScore += score;
count ++;
NumberFormat nf = NumberFormat.getInstance();
NumberOfScoresTF.setText(nf.format(count));
int avgScores = sumScores/count;
AverageScoresTF.setText(nf.format(avgScores));
}
Upvotes: 0
Views: 505
Reputation: 236004
All of the values will get lost as soon as the method exits, because the variables are local to the method. If you need to "remember" values between method invocations, then declare sumScore
and count
as attributes in the class.
Upvotes: 2