if it's a square, it has bounds.
add the mouselistener to graphics panel.
check if the (current) bounds contain the
point of the mouse click.
Joined: Sep 29, 2012
didnt check what you meant, can you give a code example?
Joined: Jun 09, 2003
the bounds of the square is a rectangle.
the rectangle class has a method contains(Point).
from mousePressed() you can get the point clicked.
if the rectangle contains the point clicked, the square
has been 'clicked'