jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes MouseDragged doesn't seem to be working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "MouseDragged doesn Watch "MouseDragged doesn New topic
Author

MouseDragged doesn't seem to be working

john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

I'm trying to learn about mouseDragged. Here is my code:

Output:

I obviously am supposed to get some system.out.println's, and there is no system output. What is wrong?
Thanks,
cc11rocks


“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 5041
    
  10

The only listeners you added are MouseListener and KeyListener. mouseDragged isn't a part of either.


luck, db
There are no new questions, but there may be new answers.
john price
Ranch Hand

Joined: Feb 24, 2011
Posts: 495

Darryl Burke wrote:The only listeners you added are MouseListener and KeyListener. mouseDragged isn't a part of either.

Thank you very much!
Solution add:

Thanks,
cc11rocks
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 4087
    
  18

It's more difficult to make mistakes like that if you make anonymous listeners, like I advised you before.

In any case, you should never have a JPanel also implement listener classes. It's very poor form.


The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MouseDragged doesn't seem to be working
 
It's not a secret anymore!