Call the getSource() method of ActionEvent to find out which button was pressed.

For example,
 
public void actionPerformed(ActionEvent event)
{
    Object source = event.getSource();
 
    if (source == button1)
        {
              // button 1 code
         }
    else if (source == button2)
        {
            // button 2 code
        }
}

This will only work if you have access to button1, button2, etc variables.

Regards,
Renoir
 

-----Original Message-----
From: João Paulo Menegatti [mailto:[EMAIL PROTECTED]]
Sent: lunes 27 de agosto de 2001 14:10
To: [EMAIL PROTECTED]
Subject: [JAVA3D] same Action Listener for buttons
 
hi,
do I have several buttons using a same Action Listener, as I will know that button was clicked?

Thank you for the attention

--
Renoir Sewjee
Software Engineer
ISS International (Welkom)
Tel: +27 (0)57 912 2702
Fax: +27 (0)57 912 2652
--
  =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to