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 Queen 8 ChessBoard Example Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Queen 8 ChessBoard Example Help" Watch "Queen 8 ChessBoard Example Help" New topic

Queen 8 ChessBoard Example Help

Russell Ray
Ranch Hand

Joined: Apr 25, 2005
Posts: 116
I wanted to post here in hopes someone could provide me some direction of now to fix my problem.:

I have a simple chessboard made up of JPanels for each location on the chessboard. Each JPanel on the board has a JLable inside of it. This label has a color (black or white). As the user clicks on the location from the board, the program swaps out the JPanel with a new one with a Queen image. This seems to be working correctly, however, the application is place a "blank" JPanel to the left of the location where the queen is placed. I opine this is causing a reschuffle of the chessboard.

Could any please give me some pointers on how I can correct this.

Here is the code:

Any assisitance would be greatly appreciated as I have been working with this issue well over three days.

Russell Ray
Ranch Hand

Joined: Apr 25, 2005
Posts: 116
I figured it out.........

The problem was in the mouseReleaseed method. What was happening was exactly as I thought...... I was removing a JPanel and replacing it with a JLabel...... I didn't think Swing Components was doing this.

Here is the code:

colin shuker
Ranch Hand

Joined: Apr 11, 2005
Posts: 750
Hi, how is your chess program going?
Are you using Alpha-beta pruning. You probably are, it is essential
for any chess program.
Have you managed to implement checkmate and stalemate?
Thats the only problem with mine, you can set it up a position, such as mate in 3, and it will solve it correctly, but however if there are a few
pieces on board, it seems to walk right into stalemate.
I just wondered if you knew how to implement checkmate and stalemate with alpha-beta.
The problem I've found is that the algorithm is too complex to test, even with 3 pieces on the board.
Basically I'm looking for some psuedocode of alpha-beta pruning that incorporates checkmate and stalemate.

Thanks, let me know how your doing if you can.
I agree. Here's the link:
subject: Queen 8 ChessBoard Example Help
It's not a secret anymore!