• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

 
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?
 
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/
 
Sheriff
Posts: 23644
48
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!