Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event Handling

 
kedar parundekar
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know,
1)The underlying OS is constantly monitoring events
2)When a event occurs, the OS reports these events to the programs that are running.

Q)How OS reports these events to programs that are running? Is there any OS event also?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50214
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I remember correctly the devices (eg mouse, keyboard) send messages whenever their state changes; these are called interrupts, and they are handled by hardware using a device called an exception handler, which does not mean the same as the term in Java programming.

Presumably somehow the OS tells the JVM that there has been an event at pixel no (500, 400) and it was a mouse click. The JVM then works out from its position that it was in the area occupied by your exitButton, and exitButton then sends an ActionEvent to whichever Listener(s) is(are) registered to it. The Listener then receives the ActionEvent into its actionPerformed() method, and you know the rest.

Anybody able to give a better explanation???

CR
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic