Criei agora um programando que calcula a media de duas notas de um aluno, e decidi criar um botão limpar, só que quando limpo a tela o programa já não volta a calcular a nota. O que fiz de errado e como posso corrigir? Obrigado.
deixo o código em baixo:
private void btmCalcActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String nome;
nome = txtNome.getText()+ " ";
String outro1, outro2;
outro1 = "O(a) ";
outro2 = "Está ";
int n1, n2;
int m;
n1 = Integer.parseInt(txtNota1.getText());
n2 = Integer.parseInt(txtNota2.getText());
m = (n1+n2)/2;
lblMedia.setText((Integer.toString(m)));
String sit = (m>=10)?"Aprovado(a) ":"Reprovado(a)";
lblSit.setText(outro1 + nome + outro2 + sit);
}
private void btmLimparActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
txtNome.setText(" ");
txtNota1.setText(" ");
txtNota2.setText(" ");
lblMedia.setText(" ");
lblSit.setText(" ");
}