• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

enablingEvent() & Adapter Classess

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all...
This is from RHE. - pg 310
True or False:-
"A component subclass that has executed enableEvents() to enable processing
of certain kind of event cannot also use an adapter as a listener for the same kind of event."
The answer given was :- false
I think the answer should be True, the Reason:-
What i don't understand is that if u r enabling an event for a component,
u r extending the component class. so if u r extending a component class
then how can u extend another class i.e. AdapterClass.
Can someone explain.
Thanks.
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shah,
The answer is False! Any component can listen for any event it wants to. By overridding enableEvents() a class can get the event before any listener. The enableEvents method should include a call to super.enableEvents() so that listeners get notified.
Think about anonymous classes such as:

Regards,
Manfred.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic