aspose file tools
The moose likes Game Development and the fly likes ActionEvent and JButton Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "ActionEvent and JButton Question" Watch "ActionEvent and JButton Question" New topic

ActionEvent and JButton Question

Bear Kim

Joined: Feb 25, 2012
Posts: 9
I'm creating an interactive tic-tac-toe game using swing graphics, in which I have nine buttons for the nine squares. Is it possible to keep track of which button is pressed as an ActionEvent?
For example, I'm trying to do this: JButton buttonChosen = _____________ where the blank would be which button was clicked by the mouse.

I'd really appreciate any help, thank you!

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
I agree. Here's the link:
subject: ActionEvent and JButton Question