dcsimg
A complicated question about event listening within two layer
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Xinhua_Liu
Posted On:   Thursday, September 26, 2002 12:57 AM

Now the situation is: the base one is a JDesktopPane,and above it are many JInternalFrames,within each JInternalFrame there are many Labels.Our purpose is that when mousedragging on the JLabel, we need to response it,for example, to draw a line between a special point in the JLabel and the current position of the mouse.But unfornately, it could catch the dragging action in the JLabel, outside it, I mean the base JDesktopPane, mouse moving action could not been catched,so I could not know the accurate position of the mouse.Remember, I have added mousemotionlistener to both JLabel and JDesktopPane. I just wonder whether I should do something on event dispatching,but I'm not very clear. So, please, Gurus here.Give me your suggestions    More>>

Now the situation is:

the base one is a JDesktopPane,and above it are many JInternalFrames,within each JInternalFrame there are many Labels.Our purpose is that when mousedragging on the JLabel, we need to response it,for example, to draw a line between a special point in the JLabel and the current position of the mouse.But unfornately, it could catch the dragging action in the JLabel, outside it, I mean the base JDesktopPane, mouse moving action could not been catched,so I could not know the accurate position of the mouse.Remember, I have added mousemotionlistener to both JLabel and JDesktopPane. I just wonder whether I should do something on event dispatching,but I'm not very clear.

So, please, Gurus here.Give me your suggestions

   <<Less

Re: A complicated question about event listening within two layer

Posted By:   Mike_Friedrich  
Posted On:   Friday, September 27, 2002 01:36 AM

Is it a drag-drop-question?
In jdk 1.3 you have to implement these interfaces:

DragGestureListener,

DropTargetListener,

DragSourceListener


In DropTargetListener.dragOver you can accept/reject the drop and draw lines to the drag-source.


If you use a MouseMotionListener you should ensure that no other listeners (from JInternalFrames?) consumes your events.


Regards, Mike

About | Sitemap | Contact