Reinilton Posted April 7, 2015 at 09:55 PM Report Share #580895 Posted April 7, 2015 at 09:55 PM Criei 3 variáveis tipo Button "botao1, botao2, botao3" e com elas criei 3 botões. Qual o método para acessar o nome da variável quando eu clicar em cada botão? Link to comment Share on other sites More sharing options...
mundo Posted April 8, 2015 at 08:44 AM Report Share #580903 Posted April 8, 2015 at 08:44 AM getLabel() Link to comment Share on other sites More sharing options...
Reinilton Posted April 8, 2015 at 09:31 PM Author Report Share #580933 Posted April 8, 2015 at 09:31 PM (edited) Acho que getLabel irá capturar o texto do botão mas eu descobri esta forma: @Override public void actionPerformed(ActionEvent e) { if(e.getSource()==botao1){ System.out.println("botao1"); } } Alguém tem outra sugestão? Edited April 8, 2015 at 11:17 PM by apocsantos geshi Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now