• Post Reply Bookmark Topic Watch Topic
  • New Topic

AWT Event Model and Swing Event Model  RSS feed

 
Roshni Singhania
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This is probably a Beginner's question, so please bear with me. I was asked by a friend whether AWT Event Model and Swing Event Model are different or the same. I couldn't answer the question, so I googled it, but it's still not quite clear to me, so I was hoping someone here could help me understand. I'd really appreciate it.

Thanks in Advance.
 
Campbell Ritchie
Marshal
Posts: 55761
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I don't think it is a beginner's question. You realise most of the Swing events actually use the java.awt.event package? There might be something in the Java™ Tutorials, but I am not sure.

Don't know any more myself, I am afraid.
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the new AWT event model, since Java 1.1, is the same as the Swing event model. Both use event listeners that you can add to components. If there is any difference then it's the added interfaces / classes in javax.swing.event.

The old AWT event model required programmers to extend component classes and override certain methods (e.g. handleEvent, keyUp, mouseDown, lostFocus) and should no longer be used.
 
Roshni Singhania
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thank you both for responding. Yes, even I got confused for the same reason that Swing components also use AWT Event Handlers, so I couldn't figure out the difference between the event models. As per my understanding so far is that the real question should be "What is the difference between Inheritance Event Model and Delegation Event Model". Correct me if I've understood incorrectly.

Thank you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!