In your example, you create an instance and add a new listener to each ActionEvent. Indeed, you must configure it once. Something like that:
public class OpenDataBaseListener implements ActionListener{ @Override public void actionPerformed(ActionEvent e){
etc...
And when you create your listeners, you have to register them once:
mntmOpenDatabase.addActionListener(new OpenDataBaseListener()); tableButton.addActionListener(new TableButtonListener()); colButton.addActionListener(new ColButtonListener());
source share