Only 44 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

mixing Hierarchical and Delegation Evt Models  RSS feed

 
Guennadiy VANIN
Ranch Hand
Posts: 898
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Java Programming Language". SL-275. Student Guide. Sun Microsystems. Revision C.1, September 1999
states on the page 9-13:<blockquote>"Although the current Java 2 SDk supports the JDK 1.0 event model in addition to the delegation model, you cannot mix the JDK1.0 and JDK1.1 event models."</blockquote>
I have difficulties with English. Does this phrase means impossibility or just a recommendation?
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It means that it is impossible. JDK1.2 supports either, but only one will be used per application.
Regards,
Manfred.
 
Guennadiy VANIN
Ranch Hand
Posts: 898
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just curiious. Is it a compiler or run-time error?
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
It is neither. The JDK 1.2 JVM will use whichever one is called for. This was required so that people who compiled JDK 1.0 class files could still work with Java 2. You can't choose which one to use if you compile with JDK1.2. You will get event delegation if you like it or not ...
Regards,
Manfred.
 
Guennadiy VANIN
Ranch Hand
Posts: 898
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not convinced. Here is a quote from
David M.Geary Graphic Java 1.2. Vol.1 AWT. The Sun Microsystems Press, p.318:

AWT TIP...
Not All Events are Delivered to Components

A common mistake when using the inheritance-based mechanism under the delegation event model is neglecting to call enableEvents(long). Under the inheritance-based event model, all events were deliverd to a component, whether the component was interested in the event or not. The delegation event model is more selective, delivering events only to components that indicate interest in the particular type of event by calling enableEvent(long) or adding a listener to the component. Therefore, if you must use the inheritance-based mechanism, don't forget to call enableEvents() for events you are interested in."

Well, Sun seems tries to silence the inheritance-based model and there is no much to read...
But I understood that it is possible to mix event models. Other opinions?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!