How to capture button click if more than one button in AspectJ?

Posted by aysenur on Stack Overflow See other posts from Stack Overflow or by aysenur
Published on 2010-05-30T18:51:03Z Indexed on 2010/05/30 18:52 UTC
Read the original article Hit count: 157

Filed under:
|

Hi all,

I wonder if we can capture that which button is clicked if there are more than one button.

On this example, can we reach //do something1 and //do something2 parts with joinPoints?

public class Test {

    public Test() {
        JButton j1 = new JButton("button1");
        j1.addActionListener(this);

        JButton j2 = new JButton("button2");
        j2.addActionListener(this); 
    }

    public void actionPerformed(ActionEvent e)
   {
      //if the button1 clicked 
           //do something1
      //if the button2 clicked 
           //do something2
   }

}

© Stack Overflow or respective owner

Related posts about button

Related posts about aspectj