JButton btn= new JButton("Botón");
btn.addActionListener(this);
...
public void actionPerformed(ActionEvent e) {
if(e.getSource() == this.hacerMagia) {
}else if(e.getSource() == this.altaCurso) {
}
}
o
.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int row = tabla.getSelectedRow();
listadoCursos.remove(row);
alimentarTabla();
System.out.println(row);
}
});