Adding action listener to Swing JButton
What you are already doing is a nice way of defining both the text for the button and the action for it at the same time.

As you're able to use Java 8, I would really recommend that you start using Java 8.

You might actually even want to consider migrating to JavaFX (that would probably require even more work though, but it could be a nice user interface upgrade).

One option, when using Java 8, is to do this:

JButton button = new JButton("A button");
button.addActionListener(this::doStuff);

private void doStuff(ActionEvent event) {
    ...
}


Or:

JButton button = new JButton("A button");
button.addActionListener(e -&gt; this.doStuff());

private void doStuff() {
    ...
}


A different approach would be to do this:

JButton createButton(String text, Runnable action) {
    return new JButton(new AbstractAction(text) {
        @Override
        public void actionPerformed(ActionEvent ae) {
             action.run();
        }
    });
}


And then:

JButton button = createButton("A button", this::doStuff);
JButton button = createButton("Another button", () -&gt; this.doStuff());