Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Mouse Listener on Component  RSS feed

Gregg Bolinger
Ranch Hand
Posts: 15304
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set a MouseListener on a JLabel. When my mouse enters this JLabel I do Component c = myPanel.getComponentAt(mx, my), where mx and my are the location point in myPanel (which has a mouseMotionListener on it).
My problem is that it is not grabbing the JLabel component. I do a System.out.println(c.toString()) and it gives me the Containter which is myPanel. Does anyone know how I can get it to grab the JLabel??

Happy Coding,
Gregg Bolinger
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!