swing - Can I listen for all drag & drop events in java? -


I want to listen to all drag and drop events on swing.

In a way I was able to hear for drag events:

  last long mask = AWTEvent.MOUSE_EVENT_MASK + AWTEvent.MOUSE_MOTION_EVENT_MASK; AWTEventListener eventListener = new AWTEventListener () {Public Zero Event Dispaced (Last AWTEvent Event) {}}; Toolkit.getDefaultToolkit () AddAWTEventListener (eventListener, mask);   

But this drop event is not available, even if not leaving the event with the mouse at the time of quitting. Is not it different on each component but to prevent all drag and drop events?

This is your complete requirement (maybe not even one possible ;-) Requires a solution, but you Started

As mentioned, during drag, all low-level input events (such as minivants, depending on the built-in OS, may be another) are swallowed by the dend-subsystem. Internally, they are converted to dragseaves, which are alternately removed by draggers. Dragons is a singleton that is used again in all DDD operations. One way to do this is:

  • Hold Global Dressource
  • Register a Draggers / Motion / Listener
  • Information from Dragusource Avenant Must be monitored

    Some snippets:

      draggers source = dragasource.get defaultdragsource (); DragSourceMotionListener DSML = New DragonSmotionListener () {@ Override Public Wide Drammausomozed (DragSourceDraigEvent DSDE) {Debug (DSDE); }}; Source.addDragSourceMotionListener (dsml); // Just some logging protected zero debugs (DragasourceAsset DSDE) {DragSource Constant Reference Reference = dsde.getDragSourceContext (); Component source = context.getComponent (); String text = source! = Null? Source.getName (): "none"; LOG.info (text + "X / Y" + dsde.getX () + "/" + dsde.getY ()); }   

    still work a lot ...

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -