count button clicks

后端 未结 8 1899
天命终不由人
天命终不由人 2020-12-16 08:58

I want to count the number of times the button is clicked using GUI.

I did this code:

private void jButton1ActionPerformed(java.awt.event.ActionEvent         


        
8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 09:26

    Change

    int clicked = 0;
    

    to be a member of your class. This way it wont be set to zero every time you press the button.

提交回复
热议问题