File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes adding MouseMotionListener to rectangle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "adding MouseMotionListener to rectangle" Watch "adding MouseMotionListener to rectangle" New topic

adding MouseMotionListener to rectangle

Bob Mazz

Joined: Mar 17, 2004
Posts: 5
Hi there. I have a JFrame paintComponent method that draws a rectangle when called as follows :
paintComponent(new Color(255,0,0), "Menu",300, 130, 270, 100);
I then call an instance of a class 'amenu':
amenu mymenu = new amenu(menucount, objectcount, 1, 3, 4, 5, 6);
the two need to be linked so the paint rectangle references the instance of the menu because next I need to be able to add a MouseMotionListener to the rectangles to move them. Any suggestions? Cheers
jQuery in Action, 2nd edition
subject: adding MouseMotionListener to rectangle
Similar Threads
Tooltip on Line2D or Rectangle2D
Do you people have a code in Swing such that 2 rectangles doesnt overlap when created
How can i have the coordinate on a buffered image ?
Polymorphism: to overriding, not to overloading