Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Buttons without clicking animation

 
Gulshan Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm making a battleship game, and I need to make a grid where the user can click to select where their ships are supposed to be and fire at enemy ships. Basically I need a button for each cell in the grid but not a button where it has the clicking animation, just a flat cell that puts a dot in the cell where the user clicked. Alternatively, I could have put a boundary on each cell and checked for a click in that boundary, but in an 8x8 grid, that is 64 boundaries to set. Sorry if that was hard to understand. If you don't understand just ask.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using a JLabel/MouseListener
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic