• Post Reply Bookmark Topic Watch Topic
  • New Topic

Not able to receive mouse events on JPanel

 
P Goel
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've a JPanel which is added in a JScrollPane. I'm adding a mouseListener on my JPanel but mouse events are not coming.
My code is as following



Please let me know why I'm not getting mouse events on JPanel???

Thanks,
Pulkit
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either you never add the listener to the panel or other components are interception the mouse events.

If you need further help then you need to create a SSCCE (Short, Self Contained, Compilable and Executable, Example Program), that demonstrates the incorrect behaviour.
 
P Goel
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying...
Actually i've solved my issue, it was experienced because getPreferredSize() method was overridden in my Jpanel class. After removing it now it is working properly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!