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
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
I agree. Here's the link:
subject: adding MouseMotionListener to rectangle
jQuery in Action, 3rd edition