public void letterChosen(ActionEvent event) {     Button source = (Button) event.getSource();     source.setVisible(false);     System.out.println("pick: "+source.getUserData()); }

Read more of this post