Results 1 to 3 of 3
  1. #1
    ehudfisher is offline Member
    Join Date
    Jul 2011
    Posts
    4
    Rep Power
    0

    Default Drag question: event not recurring

    Hey,

    I've looked all over and cannot find an answer to a question i have.

    I have a class implementing MouseListener. Trying to use drag/drop mechanism - I seem to have a problem. Irom the MouseDragged event I call a method from the component the mouse is over, lets call it class A (abstract). The method is implemented in classes B(mothod does nothing) and C(mothod does some not-so-heavy lifting) that extend A.

    The problem is, when the implementation in class C is executed, it brings to a hold the recurrance of the swing drag events. I printed to the screen every time an event occurs to try and debug, and the output is:

    if the empty method is called:
    "MousePressed MouseDragged MouseDragged...(repetitive) MouseDragged Mosereleased"

    if the fully implemented method is called:
    "MousePressed MouseDragged"

    I tried to use InvokeLater but didn't think it would help and it didn't. I also tried running the "heavier" code in a different thread (created a thread subclass in class C that calles the original method, and created an instance of it + started it. Did not work either.

    Ideas? Im grasping at straws here..

    Thanks!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default

    To get better help sooner, post a SSCCE that clearly demonstrates your problem.

    Don't forget to use the code tags so your code retains its formatting.

    db

  3. #3
    ehudfisher is offline Member
    Join Date
    Jul 2011
    Posts
    4
    Rep Power
    0

    Default

    Got it. Dumb mistake - tried to redraw un the middle of the drag and obviously that killed everything. Thanks.

Similar Threads

  1. Drag and Drop disables Event Listeners?
    By qwerty4030 in forum AWT / Swing
    Replies: 1
    Last Post: 10-01-2010, 04:36 AM
  2. Simple mouse event question
    By alacn in forum New To Java
    Replies: 13
    Last Post: 06-21-2010, 03:53 AM
  3. Looping and Recurring
    By tim in forum New To Java
    Replies: 7
    Last Post: 12-22-2009, 08:52 PM
  4. checking for an event during an event
    By infinity in forum AWT / Swing
    Replies: 22
    Last Post: 04-09-2009, 01:08 AM
  5. Exception Event question
    By josephdcoleman in forum New To Java
    Replies: 0
    Last Post: 03-12-2009, 06:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •