File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Checkers Piece Movement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Checkers Piece Movement" Watch "Checkers Piece Movement" New topic

Checkers Piece Movement

Sultan Ali

Joined: Jul 21, 2011
Posts: 7
Hi everyone, I'm working on a checkers game, i have problem with piece movements, currently i have few classes which i will upload, but my main problem is that i can't move my piece to a new location within the board, I have it so that when a piece is clicked it position is checked, and the mouse listens to a new square that user clicks, if the square doesn't have a piece on it then a Boolean is set to true.
I really need an advice help of how i could go about moving the pieces to a new location within the board.

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
one of the ways would be to have your board made up of JLabels, and the checkers as images/icons.

then, after your mouseclicks/move validation, you set the icon of the old label to null, and the
label of new location to that of the old label's icon.
I agree. Here's the link:
subject: Checkers Piece Movement
It's not a secret anymore!