-
recognise mouse click og area already drawn
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks