- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsOk so i am trying to make a simple chess game using java and these are the instructions i got from my proffessor: Purpose:
The purpose of this project is to demonstrate that you can use the object oriented principles of polymorphism, inheritance, and information hiding. Also I want you to demonstrate that you can use Java collections.
Assignment:
I want you to write a program to show how chess pieces move. Start with an abstract super class Chess Piece and inherit all the normal chess pieces from it. Each piece should then be able to calculate where exactly it can move on the board. Remember you need to worry about edges and other pieces.
Your program should be able to set up a game from the beginning and to load a board with pieces from the middle of a game. I should be able to choose a piece and see all the possible moves that can be made with that piece. Once I choose a move, you should show me all the pieces that can take that piece. You should use a JPanel user interface. You do not need to worry about making the chess board have black and white squares (you can make them all one color) and you can use letters for the chess pieces if you like. You may also use JOptionPane input dialogs for user input.
I want you to use at least two different collections in this program. Start with inheriting pieces, finding moves when alone on the board, and then finding moves when other pieces are on the board. Do not put a lot of code in main. Main should only set up any graphics you decide to use and call one of your objects.
ok now i think i know what im doing but there could be an easier way. i need to know how to move my chess piece with the mouse listener. also i want to display the possible moves a piece can make when i click on it. if anyone has any suggestions i would appreciate it. source code would be especially helpful. thank you.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: TavicPosted on 2008-12-02 at 19:31:49ID: 23082984
Your instructor mentioned that you have to use a JPanel UI. Did he prohibit you from using other components within the JPanel? If he says it's ok, using an 8x8 JTable would be much more effective, as you can listen for selection events on a per-cell basis, as well as display icons and set width and height per cell.
If you have to do the entire thing by painting on a panel, it's gonna be pretty complicated.