File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "adding MouseMotionListener to rectangle" Watch "adding MouseMotionListener to rectangle" New topic
Author

adding MouseMotionListener to rectangle

Bob Mazz
Greenhorn

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
 
wood burning stoves
 
subject: adding MouseMotionListener to rectangle
 
Similar Threads
MouseDragg
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