You should replace your scoreadd
method by this:
public void scoreadd(){
Scorelbl.setText(String.valueOf(++scoreadd));
}
The attribute scoreadd
is already there. The ++scoreadd
operation increases its value by 1. Then, the label is updated.
1
solved How to make a variable that can be used for storing integer data in Java GUI