Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MouseDragged doesn't seem to be working

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only listeners you added are MouseListener and KeyListener. mouseDragged isn't a part of either.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 5553
53
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic