You nearly have it.

e.getSource() returns an object. Cast it into a JButton like so:


JButton source = (JButton) e.getSource();
System.out.println(source.getText());