Best way to handle a chess interface?

Hey guys!

I’m working on my own chess game, which won’t aim to be better than the ones already out, but instead as a project for myself to get to know Java a bit better. I’ve started working on the graphics and the soul of the game simultaneously, but this topic should strictly be about the interface. I plan to create the whole interface with Swing if possible - and why wouldn’t be? :slight_smile:

My main question to you is the following: What would you suggest as the best way of handling the board with the pieces? I want them, the pieces to be draggable, and nothing more. I have png files, I know how I can open them, and I’m aware of the drawImage(…) method as well, but I’m uncertain if I should use the JLabel, ImageIcon or some other classes for this?

Any help would be great!
Thank you!

I would use a java.awt.Canvas to draw the images. I would then add a MouseListener to the canvas to check for mouseevents. With a MouseListener you can check when the user clicks, releases, moves and drags the mouse and get the position of it

I’m going to check out the Canvas class. Thank you for your hint!