Fórum Não consigo identificar QUAL dois JButtons foi clicado - ActionListener #573430
02/01/2017
0
Não consigo identificar QUAL dos botões foi clicado.
O seguinte trecho não está sendo "executado":
Somente System.out.println("entrou no metodo"); é executado.
O que será que está havendo?
O seguinte trecho não está sendo "executado":
if (event.getSource() == bSair) {
System.exit(0);
}
Somente System.out.println("entrou no metodo"); é executado.
ButtonHandler handler = new ButtonHandler();
bCadastrar.addActionListener(handler);
bRelatorio.addActionListener(handler);
bSair.addActionListener(handler);
public class ButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent event) {
System.out.println("entrou no metodo");
if (event.getSource() == bSair) {
System.exit(0);
}
}
}
O que será que está havendo?
Vinnicius Rosa
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)