I haave a program which draws small filled Ellipse2D objects into a JPanel whenever a mouse button is clicked.

The differant circles created by the mouse clicks are stored in an array of objects. The Ellipse2D objects class contains all the relevent information about the Ellipse such as its X and Y co-ordinates.

I now want my program to recognise when i click within the area of an object that has already been drawn. I basically want to be able to drag the drawn Ellipses and hus change the X an Y co-ordinates of the relevant object in the array.

So basically

public void mouseDragged(MouseEvent event) {
//something in here which recognises the x and y co-ordinats of the Ellipse and
vertArray[whichever object is relevant].setX = event.getX();

vertArray[whichever object is relevant].setY = event.getY();

i need help with the recognising that the area being clicked on has already been drawn?

please help its driving me nuts