Michael Dunn wrote:> como evitar el uso de if cuando estoy manejando muchos botones en un formulario
if you could translate this to english, a lot more people could possibly help you
sorry no speak english . . .traduction google . . please wait . .i´m
java student in institute
and avoid using if the event is generated when you press a button I'm making a game with 9 buttons for a year and I'm using if. . but leave many
public void actionPerformed(ActionEvent e){
if(e.getSource()==btn1){
btn1.setText("X");
}
else if(e.getSource()==btn2){
btn2.setText("X");
}
else if(e.getSource()==btn3){
btn3.setText("X");
}
else if(e.getSource()==btn4){
btn4.setText("X");
}
else if(e.getSource()==btn5){
btn5.setText("X");
}
else if(e.getSource()==btn6){
btn6.setText("X");
}