Here i draw the board for chess and put all pieces in there places on the board ... then i want when i pressed by mouse on the board
give me the value of x , y .

I tried with all things but i cann't solve this problem
please see my code >>> I think the problem in class pieces

hint: the code is combiled and run good
---------------------------------------------------------
http://www.4shared.com/file/138136415/b911666c/_3__BoardGame1.html
-----------------------------------------------------
thanks

Try setting your Pawn panels to a background color of green or something and see if anything that's displayed ends up being that color. If it isn't displayed, it can't be clicked. You have this line:

new Pawn();

which creates Pawn objects, but these objects never get displayed? You create Pawn objects but don't add them to anything. Comment the line above out and delete the Pawn class and you'll still get the board displayed.

Edited 7 Years Ago by VernonDozier: n/a

please illustrate your answer with code
to understand you
thanks

The code is this. Delete the line "new Pawn ()" and delete the entire Pawn.java file and your program will compile and run the exact same way. When you have a line like "new Pawn ()", all that does is create a new Pawn object that you cannot ever access since you have not assigned it a reference like this:

Pawn newPawn = new Pawn ();

Now you can access newPawn and add it to your larger container, whatever that is (the Chess board or whatever).

You don't do that, yet somehow a full Chess board appears, including the Pawns, so you are doing that somewhere else (I don't know where), and you are adding Pawns without using the Pawn class. You have to figure out where that is and rethink what the Pawn class represents, as well as all of your other classes.

This article has been dead for over six months. Start a new discussion instead.