I have a button that adds a variable: x + 1
, and every time I click this button, the variable will increase by 1 unit.
But how do I program a button to change the function of button 1, so that instead of x + 1
, be x + 2
The buttons, and all of these, are being programmed in Java JFrame
with the program netBeans
.
private int xi;
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
xi++;
jLabel2.setText("Your money " + xi + "$");
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
//E neste butao que quero fazer a funcao.
}