First of all I am not asking about Event **Handling**. I know handling is implemented using the Observer pattern.

Let me take a small example. Suppose I have a Jbutton on a JFrame. I click on top of this button. 
Now how does the button know that I have clicked it? 

1) Is there any java thread waiting for the click? If so from where does this code come from (wait till I get clicked part)? Then Does each and every swing component is waiting for events on top of threads? I assume this is a very expensive task.

2) If not, how does this work?