Sign in to follow this  
llaman

[java] chess gui

Recommended Posts

I'm looking for suggestions on going about a chess board gui. I want this to look very nice, not cheaply done, since it will be used with several different side projects I am beginning to work on such as an correspondance chess client and notation converters. I would prefer the pieces to be "drag and drop", all ideas are fine with me though. Resizeable is also desired. I wasn't sure what the best way to go about it was as far as having many panels, or one big canvas, etc, etc. I haven't dealt with drag and drop with java before, so i'm really not sure what the best things to use are as far as the inner work or even the best type of images for it. Any suggestions will help. A board functioning much like the one from games.yahoo.com/ch would be best. It needs to be able to have custom positions built as well, and scroll through to earlier parts of the game, and possibly through different branches. Any GUI experts out there know a good way of tackling this side of the project?

Share this post


Link to post
Share on other sites
I would suggest using a large image for the actuall board. This means that you could interchange the board with new ones and people could make new boards/pieces for your game.

Drag and drop is pretty easy... make a 2d array of rectangles and see which one the pointer is in when it clicks, from there just make the piece's location be the same as the pointer until it isn't clicked anymore, do another run through the rectangle to see which square it goes into and there you go...

To be able to scroll through the earlier parts of the game just include a long list of all moves in the game and just simply reverse them to get where you want...

I'm sure you probably wanted more on the lines of code, but I hope this helps...

Share this post


Link to post
Share on other sites
I'm not sure if a large image would be best or not. It may get to be a hastle when it comes to resizing and drag-and-drop.

Would it not be better to keep them seperate and just simply use listeners for them?
or I suppose maybe a combination of both would be best. Have an image with hidden panels behind it for detection?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this