This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MouseDragged doesn't seem to be working  RSS feed

 
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: 5167
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
Saloon Keeper
Posts: 7817
142
  • 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
Boost this thread!