I gave three solutions for the problem earlier.how i can perform different tasks for the different buttons in the controller class
The second and third solutions put data into the object reference passed to the ActionListener method which could get that data and from it know which button was pressed.
One used the JComponent class's ClientProperty methods: get... and put...
The other extended the JButton class with your own class which could have methods the listener method could call. Use the getSource() method to get the object reference and cast that object reference to an instance of your class that extended the JButton class. With that reference to your class you can call its methods.