• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add own Listener if add method is not supported?  RSS feed

 
Valery Lezhebokov
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
The problem is that I have inherited the class MyTrayIcon from TrayIcon with implementing of MouseListener interface to handle mouse double click. But TrayIcon doesn't have method 'addMouseListener' as MyTrayIcon doesn't. So, how can I add listener is this case?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Valery Lezhebokov:
Hi!
The problem is that I have inherited the class MyTrayIcon from TrayIcon with implementing of MouseListener interface to handle mouse double click. But TrayIcon doesn't have method 'addMouseListener' as MyTrayIcon doesn't. So, how can I add listener is this case?


A class may be the source of mouse events and so have methods addMouseListener and removeMouseListener, or it may observe mouse events and so implement the MouseListener interface, but it is rare that a class will do both. Why do you insist on wanting to add MouseListeners to TrayIcon? And in what package/framework is TrayIcon defined? I don't see it in the J2SE/J2EE.
 
Valery Lezhebokov
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeff Albertson:


A class may be the source of mouse events and so have methods addMouseListener and removeMouseListener, or it may observe mouse events and so implement the MouseListener interface, but it is rare that a class will do both. Why do you insist on wanting to add MouseListeners to TrayIcon? And in what package/framework is TrayIcon defined? I don't see it in the J2SE/J2EE.


I need to handle Doubleclick event of tray icon. Is there any other way to handle it besides adding listener?
JDIC library contains this class.
https://jdic.dev.java.net/
 
Paul Clapham
Sheriff
Posts: 22509
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Valery Lezhebokov:
JDIC library contains this class.
https://jdic.dev.java.net/
I followed that link, and noticed that there's a discussion forum for that package. If you can't get an answer there, where people are totally focussed on the package, then you are unlikely to get one here.
 
Valery Lezhebokov
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for advice, I'll try.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!