i have these buttons what i wanna do is when i press any of them change the button name to "Ouch!"
import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class sudokou extends Applet {
Button num[] = new Button[9];
int x, y, i, j, n = 0, num_x = 400, num_y = 45, grid_x = 400, grid_y = 100,
xx = 0, yy = 0;
public void init_numSolvers() {
for (x = 0; x < 9; x++) {
n++;
num[x] = new Button("" + n);
add(num[x]);
num[x].setBounds(num_x, num_y, 40, 40);
setLayout(null);
num[x].setActionCommand("" + n);
num_x += 40;
}
}
}